Sure, let's go down this rabbit hole again
Update: I originally hit publish too soon; this is the updated article.
I don't feel like I fully covered one aspect of protocols with associated types: why can they be such a pain to work with?
Why Associated Types
This rabbit hole just keeps on going; see my third article in the Associated Types series for a better explanation for why . . .
This is a no-bullshit zone
Let's learn what Monads, Applicatives, and Functors are, only instead of relying on obscure functional vocabulary or category theory we'll just, you know, use plain english instead.
Functors are containers you can call
map on. That's it. Seriously.
A million words of category theory and Haskell examples to say Functors . . .
It's parameters all the way down
Update: You can read even more about type erasure with lots of example code
More specifically, what is type erasure in the context of Swift and Protocols . . .
We live in an imperfect world. It isn't always practical to throw out all your Objective-C code and start over. Framework authors (including Apple) are even more constrained: lots of apps aren't 100% Swift and won't ever be. Making the next version of Photos.framework only available to Swift is a non-starter.
What's a team . . .
For the most part the new Photos.framework is a refreshing replacement for the old Asset Library interface. It was so clearly built to handle the massive (and every increasing) size of photo libraries.
There are a few sore spots. The first is annoying but minor: The title that Photos displays for an individual photo is not . . .
A new beta means a new compiler. Check out the official release notes for more information.
- Lots of compiler crashes have been fixed.
- You can use
#if swift(>=x.y)checks to gate the use of compiler features. This should finally make it possible to have a single branch support multiple versions of Swift simultaneously (though . . .
The bug fixes continue to come flooding in. As always, get the full details in the official release notes.
- Failable and throwing initializers can both exit before initializing all stored properties or calling
- Nested C structs now import as nested Swift structs
@objcis now valid on enums and enum cases so you can . . .