Skip to content

Instantly share code, notes, and snippets.

View drewster99's full-sized avatar

Andrew Benson drewster99

  • Nuclear Cyborg Corp
  • Minnesota USA
View GitHub Profile
@drewster99
drewster99 / AutoResizeViewControllerForKeyboard.swift
Last active January 25, 2021 16:44
Move views out of the way when keyboard appears, Swift 4.1, using Auto-Layout / Interface Builder / Storyboard
{
// Move views when keyboard appears/disappears
// Snipped from ViewController.swift
// This constraint should be tied to the top superview or safe area in Storybaord
@IBOutlet weak var closeButtonTopConstraint: NSLayoutConstraint!
private var topConstraintOriginalConstant: CGFloat?
private var topConstraintScrolledConstant: CGFloat = 0