When iterating over any Swift collection using a standard for loop, there are two key components that decide what elements that will be passed into our iteration code โ a sequence, and an iterator. For example, Swiftโs standard Array type is a sequence, and uses IndexingIterator as its iterator type. While we very often interact […]
Peeking at command-line ANSI escape sequences 28 October 2020 Command-line programs use color to convey additional information and to look pretty. For example, compare the output of ls with and without the –color flag: The color helps convey information in this compact output that would otherwise only be available in more verbose forms (-l). In […]
A large part of the Swift Standard Library is concerned with Generators, Sequences and Collections and functions that operate on them, so itโs pretty important to have a good understanding of them. I was going to write a blog post about how to create and use Swift generators and sequences. But while I was trying […]