Swift Guide to Map Filter Reduce
Next time you find yourself looping over a collection check if you could use map, filter or reduce:
- map returns an Array containing results of applying a transform to each item.
- filter returns an Array containing only those items that match an include condition.
- reduce returns a single value calculated by calling a combine closure for each item with an initial value.
map Full: