Skip to content

Instantly share code, notes, and snippets.

View jpmcglone's full-sized avatar

John P. McGlone jpmcglone

View GitHub Profile
@jpmcglone
jpmcglone / gist:5a5e866ef333716d6d88b55f93b95e15
Created August 13, 2016 21:58
Remove All Gesture Recognizers
func removeAllGestureRecognizers() {
gestureRecognizers?.forEach(self.removeGestureRecognizer)
}
@jpmcglone
jpmcglone / Array+Additions.swift
Created August 8, 2016 18:43
Array extension: prepend
import Foundation
extension Array {
mutating func prepend(newElement: Element) {
self.insert(newElement, atIndex: 0)
}
}
@jpmcglone
jpmcglone / Array+Additions.swift
Last active March 14, 2019 17:38
array.filter into multiple arrays in one pass
public struct ConditionalArrayFilter <Element> {
let condition: (Element) -> Bool // the condition to meet
private var _array = Array<Element>()
var array: Array<Element> {
get { return _array }
}
init(condition: (Element) -> Bool) { self.condition = condition }
}
private extension ConditionalArrayFilter {