Swift — Operate on collection using closure
Sometimes when you find yourself looping over a collection, your first instinct is to use the familiar for-loop. In Swift colletion types such as Array or Dictionary or Set, there are a few methods that help you do so with cleaner code. These methods use…