A Protocol for Composition
summary
Lyft refactors large view controllers into many small reusable pieces using Swift protocol extensions, giving default implementations (so a view controller can opt in without inheritance). A concrete example is a ride requester protocol with a default request implementation, and a map state displayable pattern that keeps one Google map instance (maps take ~0.5s to load on a 5S) while swapping lightweight child controllers. The team reaches ~120 protocols, shrinks controllers, and improves reuse and testability.
AI-written summary · about
chapters (30)
- 0:00Introduction
- 0:45Overview
- 1:23Protocols
- 2:09Polymorphic Code
- 3:03User
- 4:15Passenger Representation
- 5:03Swift Protocol Extensions
- 6:02Mockup
- 8:43The Class Graph
- 9:54Refactoring
- 10:21Sharing
- 12:27Write Requester
- 13:06Request a Lift
- 13:32ViewController subclass
- 14:08Protocol Extensions
- 16:51Complex UI
- 17:01Reusable Pieces
- 17:27Modals
- 18:03Venues
- 20:07View Hierarchy
- 20:49MapStateDisplayable
- 21:52Custom Animations
- 22:14MapState Presenter
- 22:45UIViewController
- 23:33ViewController
- 24:18Map Observer
- 25:03Map Updates
- 26:02Feature Highlighter
- 27:29Conclusion
- 28:03QA








