Skip to content

Instantly share code, notes, and snippets.

View marquavious's full-sized avatar
🎯
Focusing

marquavious

🎯
Focusing
View GitHub Profile
@marquavious
marquavious / movekeyboardup.swift
Created May 17, 2017 04:55
A simple way to move the screen up when the keyboard is apparent
// Make sure you add the observer.
func addObserverToKeyboard(){
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: NSNotification.Name.UIKeyboardWillShow, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(notification:)), name: NSNotification.Name.UIKeyboardWillHide, object: nil)
}
func keyboardWillShow(notification: NSNotification) {