How Not to Write Swift
summary
Shows concrete examples and fixes: recommends start with concrete types because protocols can force heap boxing and dynamic dispatch for heterogenous arrays and kill performance, while generics let the compiler specialize and inline. Advises avoiding deep inheritance in UIKit to prevent hidden cruft and tight coupling and suggests refactor to small protocols later using extension intent points and associated types. Promotes loud failure for programmer errors with use assertions and preconditions and fatalError and uses StaticString for bundle resources. squeeze your protocols into minimal constrained pieces.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 1:21Pragmatism vs opinionated
- 2:56The hoodie of truth
- 4:02Four areas to explore
- 4:30Using protocols wisely
- 9:34Avoiding inheritance pitfalls
- 12:50Advanced protocol techniques
- 16:03The necessity of crashing
- 19:26Conclusion
related talks
46mGeneric Swift: It Isn't Supposed to Hurt
30mLeveraging Swift's Type System
18mSilver Bullets in Swift
23mDeclarative Programming in Swift
48mLearning From Our Elders: Applying functional insights without losing Swift
40mLeveraging Swift’s Type System
55mEmerging Best Practices
53mSwift: New Paradigms for iOS Development
