@@ -15,30 +15,23 @@ A small (but cool) tool for handling UIKeyboard appearing and disappearing in yo
1515## 📦 Installation
1616
1717### Carthage
18+ ~~~ bash
19+ github " nodes-ios/KeyboardHelper" ~ > 1.0
1820~~~
19- github "nodes-ios/KeyboardHelper"
20- ~~~
21+
22+ > Last versions compatible with lower Swift versions:
23+ >
24+ > ** Swift 2.3**
25+ > ` github "nodes-ios/KeyboardHelper" == 0.10.0 `
26+ >
27+ > ** Swift 2.2**
28+ > ` github "nodes-ios/KeyboardHelper" == 0.9.4 `
2129
2230### CocoaPods
2331~~~
24- pod 'KeyboardHelper', '~> 0.9 '
32+ pod 'KeyboardHelper', '~> 1.0 '
2533~~~
2634
27- ### Swit Package Manager
28- To use KeyboardHelper as a [ Swift Package Manager] ( https://swift.org/package-manager/ ) package just add the following to your ` Package.swift ` file.
29-
30- ~~~ swift
31- import PackageDescription
32-
33- let package = Package (
34- name : " YourPackage" ,
35- dependencies : [
36- .Package (url : " https://github.com/nodes-ios/KeyboardHelper.git" , majorVersion : 0 )
37- ]
38- )
39- ~~~
40-
41- ** NOTE:** This doesn't currently work as SPM doesn't support iOS, but once it will we will already be supporting it! :)
4235
4336## 🔧 Setup
4437Implement ` KeyboardNotificationDelegate ` in your UIViewController.
@@ -47,12 +40,16 @@ Implement `KeyboardNotificationDelegate` in your UIViewController.
4740class ViewController : UIViewController , KeyboardNotificationDelegate
4841```
4942
50- Add a `KeyboardHelper` private variable and initialize it, setting the delegate.
43+ Add a `KeyboardHelper` private variable, initialize it and set the delegate.
5144
5245```swift
5346private var keyboardHelper : KeyboardHelper ?
54- ...
55- self.keyboardHelper = KeyboardHelper(delegate: self )
47+
48+ func viewDidLoad() {
49+ ...
50+ self .keyboardHelper = KeyboardHelper (delegate : self )
51+ ...
52+ }
5653```
5754Implement the two methods in the ` KeyboardNotificationDelegate ` :
5855
@@ -78,17 +75,17 @@ func keyboardWillAppear(_ info: KeyboardAppearanceInfo) {
7875 completion :nil )
7976 }
8077
81- func keyboardWillDisappear (_ info : KeyboardAppearanceInfo) {
82- UIView.animate (withDuration : TimeInterval (info.animationDuration ),
83- delay : 0 ,
84- options : info.animationOptions ,
85- animations : {
86- let insets = UIEdgeInsetsZero
87- self .scrollView .contentInset = insets
88- self .scrollView .scrollIndicatorInsets = insets
89- },
90- completion :nil )
91- }
78+ func keyboardWillDisappear (_ info : KeyboardAppearanceInfo) {
79+ UIView.animate (withDuration : TimeInterval (info.animationDuration ),
80+ delay : 0 ,
81+ options : info.animationOptions ,
82+ animations : {
83+ let insets = UIEdgeInsetsZero
84+ self .scrollView .contentInset = insets
85+ self .scrollView .scrollIndicatorInsets = insets
86+ },
87+ completion :nil )
88+ }
9289```
9390
9491The ` KeyboardAppearanceInfo ` object has the following properties:
0 commit comments