KeyboardManager Documentation

Enumeration Keyboard​Observer

public enum KeyboardObserver  

Keyboard observer is a namespace for subscription static methods

Methods

add​Observer(_:​_:​)

public static func addObserver(
        _ notificationCenter: NotificationCenter = .default,
        _ observer: @escaping KeyboardManagerEventClosure
    ) -> KeyboardObserverToken  

Add observer closure for observing keyboard events

Parameters

notification​Center Notification​Center

notification center to observe notifications

observer @escaping Keyboard​Manager​Event​Closure

closure for observing events

Returns

observer token that store subscription

add​Observer(_:​superview:​bottom​Constraint:​bottom​Offset:​safe​Area​Insets:​animated:​)

public static func addObserver(
        _ notificationCenter: NotificationCenter = .default,
        superview: UIView,
        bottomConstraint: NSLayoutConstraint,
        bottomOffset: CGFloat = 0.0,
        safeAreaInsets: @escaping () -> UIEdgeInsets = { UIEdgeInsets.zero },
        animated: Bool = false
    ) -> KeyboardObserverToken  

Automatically adjusts view's bottom constraint offset after receiving keyboard's notifications

Parameters

notification​Center Notification​Center

notification center to observe notifications

superview UIView

parent view for adjusted constraints

bottom​Constraint NSLayout​Constraint

current bottom constraint instance

bottom​Offset CGFloat

minimal preserved constraint offset value

safe​Area​Insets @escaping () -> UIEdge​Insets

safe area generator for compensate offset for view controllers with tabbar

animated Bool

should changes be animated

Returns

observer token that store subscription

add​Observer(_:​scroll​View:​)

public static func addObserver(
        _ notificationCenter: NotificationCenter = .default,
        scrollView: UIScrollView
    ) -> KeyboardObserverToken  

Automatically adjusts scrollView's contentInset property with animation after receiving keyboard's notifications

Parameters

notification​Center Notification​Center

notification center to observe notifications

scroll​View UIScroll​View

scroll view instance

Returns

observer token that store subscription