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

Commit 523dce2

Browse files
Chris CombsDominik Hadl
authored andcommitted
updated to beta 6
1 parent d7a5a65 commit 523dce2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

KeyboardHelper/Classes/KeyboardAppearanceInfo.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ import UIKit
1515
public struct KeyboardAppearanceInfo {
1616

1717
public let notification: Notification
18-
public let userInfo: [NSObject: AnyObject]
18+
public let userInfo: [AnyHashable: Any]
1919

2020
public init(notification: Notification) {
2121
self.notification = notification
22-
self.userInfo = (notification as NSNotification).userInfo ?? [:]
22+
self.userInfo = notification.userInfo ?? [:]
2323
}
2424

2525
/**
2626
Getter for the UIKeyboard frame begin infokey.
2727
Return a `CGRect` or `CGRectZero`.
2828
*/
2929
public var beginFrame: CGRect {
30-
return userInfo[UIKeyboardFrameBeginUserInfoKey]?.cgRectValue ?? CGRect.zero
30+
return (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue ?? .zero
3131
}
3232

3333
/**
3434
Getter for the UIKeyboard frame end infokey.
3535
Return a `CGRect` or `CGRectZero`.
3636
*/
3737
public var endFrame: CGRect {
38-
return userInfo[UIKeyboardFrameEndUserInfoKey]?.cgRectValue ?? CGRect.zero
38+
return (userInfo[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue ?? .zero
3939
}
4040

4141
/**
@@ -45,7 +45,7 @@ public struct KeyboardAppearanceInfo {
4545
*/
4646
public var belongsToCurrentApp: Bool {
4747
if #available(iOS 9.0, *) {
48-
return userInfo[UIKeyboardIsLocalUserInfoKey]?.boolValue ?? true
48+
return (userInfo[UIKeyboardIsLocalUserInfoKey] as? NSString)?.boolValue ?? true
4949
} else {
5050
return true
5151
}
@@ -56,7 +56,7 @@ public struct KeyboardAppearanceInfo {
5656
By default: `0.25`.
5757
*/
5858
public var animationDuration: Double {
59-
return userInfo[UIKeyboardAnimationDurationUserInfoKey]?.doubleValue ?? 0.25
59+
return (userInfo[UIKeyboardAnimationDurationUserInfoKey] as? NSString)?.doubleValue ?? 0.25
6060
}
6161

6262
/**
@@ -84,7 +84,7 @@ public struct KeyboardAppearanceInfo {
8484
- animationBlock: Animation that should happen.
8585
- completion: Function that happens after the animation is finished.
8686
*/
87-
public func animateAlong(_ animationBlock: () -> Void, completion: (finished: Bool) -> Void) {
87+
public func animateAlong(_ animationBlock: @escaping () -> Void, completion: @escaping (_ finished: Bool) -> Void) {
8888
UIView.animate(
8989
withDuration: animationDuration,
9090
delay: 0.0,

0 commit comments

Comments
 (0)