@@ -15,27 +15,27 @@ import UIKit
15
15
public struct KeyboardAppearanceInfo {
16
16
17
17
public let notification : Notification
18
- public let userInfo : [ NSObject : AnyObject ]
18
+ public let userInfo : [ AnyHashable : Any ]
19
19
20
20
public init ( notification: Notification ) {
21
21
self . notification = notification
22
- self . userInfo = ( notification as NSNotification ) . userInfo ?? [ : ]
22
+ self . userInfo = notification. userInfo ?? [ : ]
23
23
}
24
24
25
25
/**
26
26
Getter for the UIKeyboard frame begin infokey.
27
27
Return a `CGRect` or `CGRectZero`.
28
28
*/
29
29
public var beginFrame : CGRect {
30
- return userInfo [ UIKeyboardFrameBeginUserInfoKey] ? . cgRectValue ?? CGRect . zero
30
+ return ( userInfo [ UIKeyboardFrameBeginUserInfoKey] as? NSValue ) ? . cgRectValue ?? . zero
31
31
}
32
32
33
33
/**
34
34
Getter for the UIKeyboard frame end infokey.
35
35
Return a `CGRect` or `CGRectZero`.
36
36
*/
37
37
public var endFrame : CGRect {
38
- return userInfo [ UIKeyboardFrameEndUserInfoKey ] ? . cgRectValue ?? CGRect . zero
38
+ return ( userInfo [ UIKeyboardFrameBeginUserInfoKey ] as? NSValue ) ? . cgRectValue ?? . zero
39
39
}
40
40
41
41
/**
@@ -45,7 +45,7 @@ public struct KeyboardAppearanceInfo {
45
45
*/
46
46
public var belongsToCurrentApp : Bool {
47
47
if #available( iOS 9 . 0 , * ) {
48
- return userInfo [ UIKeyboardIsLocalUserInfoKey] ? . boolValue ?? true
48
+ return ( userInfo [ UIKeyboardIsLocalUserInfoKey] as? NSString ) ? . boolValue ?? true
49
49
} else {
50
50
return true
51
51
}
@@ -56,7 +56,7 @@ public struct KeyboardAppearanceInfo {
56
56
By default: `0.25`.
57
57
*/
58
58
public var animationDuration : Double {
59
- return userInfo [ UIKeyboardAnimationDurationUserInfoKey] ? . doubleValue ?? 0.25
59
+ return ( userInfo [ UIKeyboardAnimationDurationUserInfoKey] as? NSString ) ? . doubleValue ?? 0.25
60
60
}
61
61
62
62
/**
@@ -84,7 +84,7 @@ public struct KeyboardAppearanceInfo {
84
84
- animationBlock: Animation that should happen.
85
85
- completion: Function that happens after the animation is finished.
86
86
*/
87
- public func animateAlong( _ animationBlock: ( ) -> Void , completion: ( finished: Bool ) -> Void ) {
87
+ public func animateAlong( _ animationBlock: @escaping ( ) -> Void , completion: @escaping ( _ finished: Bool ) -> Void ) {
88
88
UIView . animate (
89
89
withDuration: animationDuration,
90
90
delay: 0.0 ,
0 commit comments