In Swift, is there a clever way of using the higher order methods on Array to return the 5 first objects? The obj-c way of doing it was saving an index, and for-loop throug
Update for swift 4:
[0,1,2,3,4,5].enumerated().compactMap{ $0 < 10000 ? $1 : nil }
For swift 3:
[0,1,2,3,4,5].enumerated().flatMap{ $0 < 10000 ? $1 : nil }