Sources/Confidence/Array+Chunks.swift (8 lines of code) (raw):

import Foundation extension Array { func chunk(size: Int) -> [[Element]] { return stride(from: 0, to: count, by: size).map { Array(self[$0..<Swift.min($0 + size, count)]) } } }