You can create a nested array and join them.
// swift 3:
for i in [r1, r2].joined() {
print(i)
}
The result joined()here is FlattenBidirectionalCollection, which means that it will not allocate another array.
(If you're stuck in Swift 2, use .flatten()instead .joined().)
source
share