Skip to content

Instantly share code, notes, and snippets.

@Aakashcs
Last active July 16, 2020 00:24
Show Gist options
  • Save Aakashcs/11458a41c3b8d96bbfa7d84e52268f82 to your computer and use it in GitHub Desktop.
Save Aakashcs/11458a41c3b8d96bbfa7d84e52268f82 to your computer and use it in GitHub Desktop.
Making 2D arrays for swiftUI multiple column list
extension Array{
func collection(into size :Int) -> [[Element]]{
return stride(from: 0, to: count, by:size).map{
Array(self[$0 ..< Swift.min($0 + size, count)])
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment