Safer Swift Code with Value Types
summary
Builds a nontrivial iOS Twitter client that downloads the latest 50 tweets, lets users favorite them, and demonstrates how to implement favorites when models are immutable. Uses Swift structs and a Flux-like dispatcher with reducers as pure functions, keeps server state and a local change set separate, merges them to derive the displayed timeline, and synchronizes mutations by replaying the change list to the API. Emphasizes immutable value types and unidirectional data flow as practical tools.
AI-written summary · about
chapters (32)
- 0:00Introduction
- 0:50Safety
- 1:34struct or class
- 2:06Outline
- 2:36Reference Semantics
- 4:11Why Value Types
- 4:47Standard Library
- 5:34Copy qualifier
- 6:11Player built
- 6:52Twitter client
- 7:56Twitter timeline
- 8:21Immutable models
- 8:41How can I model change
- 9:10Multiple threads of references
- 10:21Protecting against updates
- 10:59Object oriented model
- 12:29Safety considerations
- 12:54Summary
- 13:10Model Changes as Values
- 15:11Flex Architecture
- 17:43State
- 18:20Actions
- 19:28Action Traders
- 20:45Favorite Tweet
- 21:11Early State Implementation
- 21:58ViewController
- 22:40Recap
- 23:14Synchronization
- 24:04Architecture
- 24:56Downsides
- 25:36Benefits
- 27:27Conclusion
related talks
53mSwift: New Paradigms for iOS Development
34mSwift: New Paradigms for iOS Development
39mSwift and You
19mThe Art of Functional State Management for iOS Apps
21mOptimizing Swift code for separation of concerns and simplicity
27mSwiftUI: Love at First Swipe or Swipe Left?
30mLeveraging Swift's Type System
22mBuilding a Social Network in Swift
