Skip to content

Instantly share code, notes, and snippets.

View roymckenzie's full-sized avatar

Roy McKenzie roymckenzie

View GitHub Profile
import UIKit
typealias KeyboardHeightDuration = (height: CGFloat, duration: Double)
// New notification type
let RemoveKeyboardNotifications = "RemoveKeyboardNotifications"
protocol KeyboardAvoidable: class {
var layoutConstraintsForKeyboard: [NSLayoutConstraint] { get }
func addKeyboardObservers()
@roymckenzie
roymckenzie / PLToggleControl.swift
Last active May 10, 2016 00:36
PLToggleControl
@IBDesignable class PLToggleControl: UIControl {
var items = [String]()
var labels = [UILabel]()
var activeLineView = UIView()
@IBInsepctable var activeTextColor: UIColor = .whiteColor()
@IBInspectable var inactiveTextColor: UIColor = .grayColor()
@IBInspectable var buttonColor: UIColor = .blackColor()
@IBInspectable var activeLineColor: UIColor = .blackColor()
@roymckenzie
roymckenzie / KeyboardAvoidable.swift
Last active September 6, 2022 19:42
Easy way to get your view controllers to respect appearance of the keyboard.
// KeyboardAvoidable
// Roy McKenzie
protocol KeyboardAvoidable: class {
func addKeyboardObservers(customBlock: ((CGFloat) -> Void)?)
func removeKeyboardObservers()
var layoutConstraintsToAdjust: [NSLayoutConstraint] { get }
}
var KeyboardShowObserverObjectKey: UInt8 = 1