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: