Once upon a time, when Swift was young, there were a couple of types called
GeneratorOf, and they could type erase stuff. “Type erase?” you may ask. “I thought we loved types.” We do. Don’t worry. Our types aren’t going anywhere. But sometimes we want them to be a little less…precise.
In Swift 2, our little type erasers got a rename and some friends. Now they’re all named “Any”-something. So
AnyGenerator and there are a gaggle of indexes and collections from
So what are these type erasers? Let’s start with how to use one and we’ll work backwards to why.