@@ -33,9 +33,9 @@ class ViewController: UIViewController {
3333 super. viewDidLoad ( )
3434 // Do any additional setup after loading the view, typically from a nib.
3535
36- NotificationCenter . default. addObserver ( self , selector: #selector( ViewController . keyboardWillShow ( _: ) ) , name: NSNotification . Name . UIKeyboardWillShow , object: nil )
36+ NotificationCenter . default. addObserver ( self , selector: #selector( ViewController . keyboardWillShow ( _: ) ) , name: UIResponder . keyboardWillShowNotification , object: nil )
3737
38- NotificationCenter . default. addObserver ( self , selector: #selector( ViewController . keyboardWillHide ( _: ) ) , name: NSNotification . Name . UIKeyboardWillHide , object: nil )
38+ NotificationCenter . default. addObserver ( self , selector: #selector( ViewController . keyboardWillHide ( _: ) ) , name: UIResponder . keyboardWillHideNotification , object: nil )
3939
4040 self . growingTextView. layer. cornerRadius = 4
4141 self . growingTextView. backgroundColor = UIColor ( white: 0.9 , alpha: 1 )
@@ -64,7 +64,7 @@ class ViewController: UIViewController {
6464
6565 @objc func keyboardWillHide( _ sender: Notification ) {
6666 if let userInfo = ( sender as NSNotification ) . userInfo {
67- if let _ = ( userInfo [ UIKeyboardFrameEndUserInfoKey ] as? NSValue ) ? . cgRectValue. size. height {
67+ if let _ = ( userInfo [ UIResponder . keyboardFrameEndUserInfoKey ] as? NSValue ) ? . cgRectValue. size. height {
6868 //key point 0,
6969 self . inputContainerViewBottom. constant = 0
7070 //textViewBottomConstraint.constant = keyboardHeight
@@ -74,7 +74,7 @@ class ViewController: UIViewController {
7474 }
7575 @objc func keyboardWillShow( _ sender: Notification ) {
7676 if let userInfo = ( sender as NSNotification ) . userInfo {
77- if let keyboardHeight = ( userInfo [ UIKeyboardFrameEndUserInfoKey ] as? NSValue ) ? . cgRectValue. size. height {
77+ if let keyboardHeight = ( userInfo [ UIResponder . keyboardFrameEndUserInfoKey ] as? NSValue ) ? . cgRectValue. size. height {
7878 self . inputContainerViewBottom. constant = keyboardHeight
7979 UIView . animate ( withDuration: 0.25 , animations: { ( ) -> Void in
8080 self . view. layoutIfNeeded ( )
0 commit comments