Grouping and Zipping
Dictionary(grouping:by:) buckets items. zip pairs sequences.
Example
let w = ["apple", "avocado", "banana"]
let g = Dictionary(grouping: w, by: { $0.first! })
print(g["a"]!)
print(Array(zip([1, 2], ["x", "y"])))Exercise
Pair arrays.
(a, b)Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.