concept keyboard notification in category ios

appears as: keyboard notifications, keyboard notification
iOS Development with Swift

This is an excerpt from Manning's book iOS Development with Swift.

  • Then, you need to detect when the keyboard shows and hides. You’ll do this by observing keyboard notifications.
  • Connect this observer method to the keyboard notification in the viewDid-Appear method:
    override func viewDidAppear(_ animated: Bool) {
       super.viewDidAppear(animated)
       NotificationCenter.default.addObserver(self,
           selector: #selector(keyboardFrameChanges),
           name: NSNotification.Name.UIKeyboardWillChangeFrame,
           object: nil)
    }