Skip to content

Instantly share code, notes, and snippets.

import UIKit
import Anchorage
protocol MessageDisplayable {
func configureMessageView(topLayoutGuide: UILayoutSupport)
func displayMessage(message: String, animated: Bool)
func hideMessageAnimated(animated: Bool)
}
extension MessageDisplayable where Self: UIViewController {
import UIKit
import Anchorage
protocol KeyboardAdjustable {
}
extension KeyboardAdjustable where Self: UIViewController {
var keyboardLayoutGuide: UILayoutSupport {
return keyboardLayoutGuideObject
@bsmith11
bsmith11 / BackAnimationController.swift
Created October 11, 2016 00:02
Rough implementation of `UINavigationController`s default pop animation
import UIKit
class BackAnimationController: NSObject {
private let duration = 0.35
private let fromContainerView = UIView(frame: .zero)
private let toContainerView = UIView(frame: .zero)
private let dimmingView = DimmingView(frame: .zero)
private let shadowImageView = UIImageView(frame: .zero)
}
@bsmith11
bsmith11 / DataSource.swift
Last active March 7, 2017 15:42
DataSource snippet
public typealias ReloadBlock = ([IndexPath]) -> Void
public protocol DataSource {
associatedtype ModelType
var reloadBlock: ReloadBlock? { get set }
var numberOfSections: Int { get }
func numberOfItems(in section: Int) -> Int