Skip to content

Instantly share code, notes, and snippets.

View farhanf's full-sized avatar

Farhan Farooqui farhanf

View GitHub Profile
@SpencerCurtis
SpencerCurtis / ShiftableViewController.swift
Last active May 20, 2020 17:45
A UIViewController subclass that manages shifting the view controller up when editing a UITextField or UITextView that would normally be obscured by they keyboard popping up so that the text input is visible.
//
// ShiftableViewController.swift
//
// Copyright © 2020 Spencer Curtis. All rights reserved.
//
/*
All you need to do is set your subclass of ShiftableViewController as the delegate for all
UITextFields and UITextViews that you want to be shifted up so the keyboard doesn't obscure it.