blob: d6d56e972664820f051dbe1e8279267ea955944d (
plain) (
blame)
1
2
3
4
5
6
7
|
extension Array {
func chunked(into size: Int) -> [[Element]] {
stride(from: 0, to: count, by: size).map { index in
Array(self[index..<Swift.min(index + size, count)])
}
}
}
|