Collection and sequence type changes
Let's begin our discussion with Swift 3 changes to Collection and Sequence types. Some of the changes are subtle and others are bound to require a decent amount of refactoring to your custom implementations. Swift provides three main collection types for warehousing your values: arrays, dictionaries, and sets. Arrays allow you to store values in an ordered list. Dictionaries provide unordered key-value storage for your data. Finally, sets provide an unordered list of unique values (that is, no duplicates allowed).
Lazy FlatMap for sequence of optional [SE-0008]
Arrays, dictionaries, and sets are implemented as generic types in Swift. They each implement the new Collection protocol, which implements the Sequence protocol. Along this path from top-level type to Sequence protocol, you will find various other protocols that are also implemented in this inheritance chain. For our discussion on flatMap
and lazy flatMap
changes, I want to focus on Sequences.
Sequences...