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

Commit e64781a

Browse files
author
Andrey Yastrebov
committed
Make protocol methods optionsl
1 parent 510d959 commit e64781a

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

Example/Cartfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "nodes-ios/KeyboardHelper" "swift-3.0"
1+
github "nodes-ios/KeyboardHelper"

Example/Cartfile.resolved

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github "nodes-ios/KeyboardHelper" "58d7c2bf19f7bc93d733290f06ae0eedf03f18a5"
1+
github "nodes-ios/KeyboardHelper" "1.1.0"

KeyboardHelper/Classes/KeyboardHelper.swift

+5
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public protocol KeyboardHelperDelegate: class {
2626
func keyboardWillDisappear(_ info: KeyboardAppearanceInfo)
2727
}
2828

29+
/// Hack to make protocol methods optional
30+
public extension KeyboardHelperDelegate {
31+
func keyboardWillAppear(_ info: KeyboardAppearanceInfo) {}
32+
func keyboardWillDisappear(_ info: KeyboardAppearanceInfo) {}
33+
}
2934

3035
/// Useful helper to keep track of keyboard changes.
3136
public class KeyboardHelper {

KeyboardHelperTests/Tests/KeyboardHelperTests.swift

-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ class HideSpyDelegate : KeyboardHelperDelegate {
4343
kai = info
4444
expectation.fulfill()
4545
}
46-
47-
func keyboardWillAppear(_ info: KeyboardAppearanceInfo) {
48-
49-
}
5046
}
5147

5248
class KeyboardHelperTests: XCTestCase {

0 commit comments

Comments
 (0)