Is there something similar to Ruby\'s Enumerable#each_slice in Swift?
Ruby example:
arr = [\"a\", \"b\", \"c\", \"d\"] arr.each_slice(2) {|s1, s2| puts s
To amend my comment:
let a = ["a", "b", "c", "d"] for var i = 0; i < a.count; i+=2 { let a1 = a[i] let a2 = a[i+1] println("\(a1)\(a2)") }
Note that this does not check for uneven count of elements.