Array

  • Divide an array into equal-length chunks. The final chunk may contain a remainder. If the chunk length is greater than the length of the original array, it returns the original array unaltered.

    Inspired by http://stackoverflow.com/q/26395766

    Declaration

    Swift

    public func chunk(splitSize: Int) -> [[Element]]