A new model for collections and indices [SE-0065]
Swift 3 introduces a new model for collections that moves the responsibility of the index traversal from the index to the collection itself. To make this a reality for collections, the Swift team introduced four areas of change:
The Index property of a collection can be any type that implements the Comparable protocol
Swift removes any distinction between intervals and ranges; leaving just ranges
Private index traversal methods are now public
Changes to ranges make closed ranges work without the potential for errors
Note
You can read the proposal at the following link https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md
Introducing the Collection protocol
In Swift 3, Foundation collection types such as Arrays, Dictionaries, and Sets are generic types that implement the newly created Collection protocol. This change was needed in order to support traversal on the collection. If you want to create custom...