November 2022
Intermediate to advanced
213 pages
3h 46m
English
In Swift, we have the concept of Sequences. Formally, Sequence is a protocol that types that need sequential and iterated access to their elements depend on. Arrays conform to Sequence, because you can iterate through them via a for-in loop, the forEach method , and with higher-order functions such as filter, map, and reduce. You can simply access their elements with a numbered index such as myArray[2]. Dictionaries are very similar. You can iterate over their keys and values in the same ways as an array, and to access an element in a dictionary, you can simply call ...