Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 9652b3a

Browse files
authored
Merge pull request #19 from nodes-ios/develop
Renaming KeyboardNotificationDelegate to KeyboardHelperDelegate
2 parents 4c39d76 + acf26ee commit 9652b3a

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

Example/KeyboardHelperDemo/ViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import UIKit
1010
import KeyboardHelper
1111

12-
class ViewController: UIViewController, KeyboardNotificationDelegate {
12+
class ViewController: UIViewController, KeyboardHelperDelegate {
1313

1414
fileprivate var tapGesture: UITapGestureRecognizer!
1515
fileprivate var keyboardHelper : KeyboardHelper?

KeyboardHelper/Classes/KeyboardHelper.swift

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ import Foundation
1010
import UIKit
1111

1212
/**
13-
Protocol `KeyboardNotificationDelegate` requires two functions.
13+
Protocol `KeyboardHelperDelegate` requires two functions.
1414
Function `keyboardWillAppear` and `keyboardWillDisappear` with parameter `info` struct `KeyboardAppearanceInfo`.
1515
*/
16-
public protocol KeyboardNotificationDelegate: class {
16+
17+
public protocol KeyboardHelperDelegate: class {
1718

1819
/**
1920
This function will recongnize a change of `KeyboardAppearanceInfo` and will be fired when the keyboard will appaear.
@@ -34,15 +35,15 @@ public protocol KeyboardNotificationDelegate: class {
3435
public class KeyboardHelper {
3536

3637
/**
37-
Delegate that conforms with the `KeyboardNotificationDelegate`.
38+
Delegate that conforms with the `KeyboardHelperDelegate`.
3839
*/
39-
public weak var delegate: KeyboardNotificationDelegate?
40+
public weak var delegate: KeyboardHelperDelegate?
4041

4142
/**
4243
Initialize the `delegate` and add the two observer for `keyboardWillAppear` and `keyboardWillDisappear`.
4344
Observers are nessecary for tracking the `UIKeyboardWillShowNotification` and `UIKeyboardWillHideNotification`, so the function that are connectet are getting fired.
4445
*/
45-
required public init(delegate: KeyboardNotificationDelegate) {
46+
required public init(delegate: KeyboardHelperDelegate) {
4647
self.delegate = delegate
4748

4849
NotificationCenter.default.addObserver(self, selector: #selector(KeyboardHelper.keyboardWillAppear(_:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
@@ -67,3 +68,6 @@ public class KeyboardHelper {
6768
NotificationCenter.default.removeObserver(self)
6869
}
6970
}
71+
72+
@available(*, deprecated, message: "KeyboardNotificationDelegate has been renamed to KeyboardHelperDelegate")
73+
public typealias KeyboardNotificationDelegate = KeyboardHelperDelegate

KeyboardHelperTests/Tests/KeyboardHelperTests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import XCTest
1010
@testable import KeyboardHelper
1111

12-
class ShowSpyDelegate : KeyboardNotificationDelegate {
12+
class ShowSpyDelegate : KeyboardHelperDelegate {
1313
var kai : KeyboardAppearanceInfo?
1414

1515
var expectation : XCTestExpectation?
@@ -29,7 +29,7 @@ class ShowSpyDelegate : KeyboardNotificationDelegate {
2929
}
3030
}
3131

32-
class HideSpyDelegate : KeyboardNotificationDelegate {
32+
class HideSpyDelegate : KeyboardHelperDelegate {
3333
var kai : KeyboardAppearanceInfo?
3434

3535
var expectation : XCTestExpectation?

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pod 'KeyboardHelper', '~> 1.0'
3434

3535

3636
## 🔧 Setup
37-
Implement `KeyboardNotificationDelegate` in your UIViewController.
37+
Implement `KeyboardHelperDelegate` in your UIViewController.
3838

3939
```swift
4040
class ViewController: UIViewController, KeyboardNotificationDelegate
@@ -51,7 +51,7 @@ func viewDidLoad() {
5151
...
5252
}
5353
```
54-
Implement the two methods in the `KeyboardNotificationDelegate`:
54+
Implement the two methods in the `KeyboardHelperDelegate`:
5555

5656
```swift
5757
public func keyboardWillAppear(_ info: KeyboardHelper.KeyboardAppearanceInfo)

0 commit comments

Comments
 (0)