Protocols with Associated Types
summary
Explains why adding an associated type makes a Swift protocol an unusable existential — the compiler treats it as an unfinished type — and gives concrete workarounds: use a generic function instead of protocol methods, hide the value behind a shadow protocol, wrap implementations with a type eraser (the AnyCollection/AnySequence pattern), or expose an equatable identifier. Builds a tiny reactive form: a Store + FormCell protocol + subscribers (about 20 lines) and demonstrates a Mac UI where multiple cells bound to the same state update correctly when a button is pressed.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:01Protocol pitfalls
- 3:56Understanding types
- 7:50Implementing protocols
- 10:14Associated types vs generics
- 12:51Solutions for usage
- 19:04Leveraging associated types
- 24:49Live coding demonstration
- 33:16Wrap up and conclusion








