https://github.com/yagiz/keyboarddismisser
KeyboardDismisser is a little Swift 4.x pod that adds a button over keyboard so that users can dismiss keyboard easily.
https://github.com/yagiz/keyboarddismisser
close dismiss ios keyboard swift
Last synced: about 1 year ago
JSON representation
KeyboardDismisser is a little Swift 4.x pod that adds a button over keyboard so that users can dismiss keyboard easily.
- Host: GitHub
- URL: https://github.com/yagiz/keyboarddismisser
- Owner: yagiz
- License: mit
- Created: 2017-03-31T14:41:56.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-10-12T08:00:51.000Z (over 7 years ago)
- Last Synced: 2025-04-11T23:15:52.038Z (about 1 year ago)
- Topics: close, dismiss, ios, keyboard, swift
- Language: Swift
- Homepage:
- Size: 1.05 MB
- Stars: 16
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KeyboardDismisser
KeyboardDismisser is a little Swift 4.x pod that adds a button over keyboard so that users can dismiss keyboard easily.
### Preview

### Installation
#### CocoaPods
```sh
pod 'KeyboardDismisser'
```
#### Manually
Just download or clone the repo and move Classes folder to your project.
### Usage
Call ```attach()``` method of singleton KeyboardDismisser instance in ```AppDelegate.swift``` or in any other root class you have.
```swift
import UIKit
import KeyboardDismisser
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
KeyboardDismisser.shared.attach()
return true
}
}
```
#### Customizing Dismissing Button
You can change the button image, size or margins. You should do any customisation before calling ```attach()``` method.
```swift
import UIKit
import KeyboardDismisser
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
KeyboardDismisser.shared.buttonImage = "keyboardDismissIcon.png"
KeyboardDismisser.shared.buttonSize = CGSize(width: 30, height: 30)
KeyboardDismisser.shared.buttonRightMargin = 10
KeyboardDismisser.shared.buttonBottomMargin = 10
KeyboardDismisser.shared.attach()
return true
}
}
```
#### Disabling/Enabling
In some cases you may want to disable KeyboardDismisser. For example if you add custom textfield accessories you may want to disable it. To do so you can use ```isDisabled``` property.
```swift
KeyboardDismisser.shared.isDisabled = true
```
License
----
MIT
**Free Software, Hell Yeah!**