Skip to content

Instantly share code, notes, and snippets.

@nithingwl
Created May 16, 2017 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nithingwl/3cf7d1b6f27450b2008cbddd0cd8355b to your computer and use it in GitHub Desktop.
Save nithingwl/3cf7d1b6f27450b2008cbddd0cd8355b to your computer and use it in GitHub Desktop.
class ViewController:UIViewController, KeyboardObserver{
//@IBOutlet weak var scrollViewOutlet:UIScrollView!
var container:UIView{
return self.view
//If container is a scrollview, create an outlet for scrollview and return it like below
//return self.scrollViewOutlet
}
//Register for Keyboard Notifications
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
KeyboardNotifications(shouldRegister: true)
}
//Deregister for keyboard Notifications
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
KeyboardNotifications(shouldRegister: false)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment