- C-a == Ctrl-a
- M-a == Alt-a
:q close
:w write/saves
:wa[!] write/save all windows [force]
:wq write/save and close
| override func targetContentOffset(forProposedContentOffset proposedContentOffset: CGPoint, withScrollingVelocity velocity: CGPoint) -> CGPoint { | |
| guard let collectionView = self.collectionView else { | |
| let latestOffset = super.targetContentOffset(forProposedContentOffset: proposedContentOffset, withScrollingVelocity: velocity) | |
| return latestOffset | |
| } | |
| // Page height used for estimating and calculating paging. | |
| let pageHeight = self.cellHeight + self.lineSpacing |
| // http://easings.net/ | |
| extension UICubicTimingParameters { | |
| public static func easeInSine() -> UICubicTimingParameters { UICubicTimingParameters(0.47, 0, 0.745, 0.715) } | |
| public static func easeOutSine() -> UICubicTimingParameters { UICubicTimingParameters(0.39, 0.575, 0.565, 1) } | |
| public static func easeInOutSine() -> UICubicTimingParameters { UICubicTimingParameters(0.445, 0.05, 0.55, 0.95) } | |
| public static func easeInQuad() -> UICubicTimingParameters { UICubicTimingParameters(0.55, 0.085, 0.68, 0.53) } | |
| public static func easeOutQuad() -> UICubicTimingParameters { UICubicTimingParameters(0.25, 0.46, 0.45, 0.94) } | |
| public static func easeInOutQuad() -> UICubicTimingParameters { UICubicTimingParameters(0.455, 0.03, 0.515, 0.955) } | |
| public static func easeInCubic() -> UICubicTimingParameters { UICubicTimingParameters(0.55, 0.055, 0.675, 0.19) } |
| extension Optional { | |
| mutating func get(orSet expression: @autoclosure () -> Wrapped) -> Wrapped { | |
| switch self { | |
| case .none: | |
| let newValue = expression() | |
| self = newValue | |
| return newValue | |
| case .some(let value): | |
| return value |
| protocol Bindable: class { } | |
| extension Bindable { | |
| typealias Function = Self | |
| func weak<Args>(_ method: @escaping ((Function) -> ((Args) -> Void))) -> ((Args) -> Void) { | |
| return { [weak self] arg in | |
| guard let `self` = self else { return } | |
| method(self)(arg) |