-
Book Overview & Buying
-
Table Of Contents
Swift 2 Design Patterns
By :
This pattern is commonly used in many languages with an array or a collection of objects. It allows iteration over a list of objects contained in a collection.
The iterator pattern allows you to iterate sequentially over an aggregated object of objects without having to know how the collection is structured.
Here, you'll find the generic UML class diagram of the pattern, but note that we will not implement it using this way.
Indeed, Swift provides some types that will simplify the implementation of the iterator pattern, without having to produce all of the needed requirements by hand.
Why reinvent the wheel? The following figure represents the generic UML class diagram:

As with every pattern described up to now, I will tell you what the participants in this pattern are even if we will not see all of them in our implementation of the pattern:
Collection: This is an abstract class that implements the association of the collection with items and the CreateIterator...
Change the font size
Change margin width
Change background colour