SIPKeyboardManager sends out informations about the current keyboard-frame via delegate
The notifications sent by iOS-keyboards can be misleading - willShow-notifications are sent out multiple times with different rects, it might miss sending a notification with the final keyboard-rect at all. This class tries to handle all the cases and ensure that you will receive the correct keyboard-frame if possible.
SIPKeyboardManager is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'SIPKeyboardManager'Create SIPKeyboardManager
var keyboardManager: SIPKeyboardManager = SIPKeyboardManager()Make view controller implement SIPKeyboardManagerDelegate
func keyboardManager(_ keyboardManager: SIPKeyboardManager, updatingKeyboardFrameTo keyboardFrame: CGRect, withAnimationDuration animationDuration: TimeInterval) {
...your code...
}The best way how to track if the keyboard is currently visible is to work with keyboardFrame.minY. The height of the keyboard frame might be unequal zero even if the keyboard is hidden.
Hendrik von Prince, [email protected]
SIPKeyboardManager is available under the MIT license. See the LICENSE file for more info.