Classes
The following classes are available globally.
-
Push/pull views when the keyboard appears and disappears.
In your UIViewController, add a KeyboardManager property:
var kb: KeyboardManager?In
viewWillAppear(_:), initialize it and use the according method to subscribe to the show and hide notifications:override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) kb = KeyboardManager(viewsToPushUp: [textField, button]) kb?.pushViewsUpWhenKeyboardWillShow() kb?.pullViewsDownWhenKeyboardWillHide() }Although not necessary anymore, if you want to stop listening to the notifications, you can call
See morekb?.stopListeningToKeyboardNotifications()withinviewWillDisappear(_:)for example.Declaration
Swift
public class KeyboardManager
-
A class used to run a function only once.
Example:
See morelet ur = UniqueRunner() var result = ur.runOnce(addNumbers(2, 2)) result = ur.runOnce(addNumbers(5, 5)) result = ur.runOnce(addNumbers(10, 10)) result == 4 // trueDeclaration
Swift
public class UniqueRunner
Classes Reference