~/talk

Protocols with Associated Types

Talkat App Builders Switzerland 2017 · 2017-04-24..04-25· [swift]
slides:none on file

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

  1. 0:00Introduction
  2. 1:01Protocol pitfalls
  3. 3:56Understanding types
  4. 7:50Implementing protocols
  5. 10:14Associated types vs generics
  6. 12:51Solutions for usage
  7. 19:04Leveraging associated types
  8. 24:49Live coding demonstration
  9. 33:16Wrap up and conclusion
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.