Leveraging the Power of State Machines in Swift
summary
Shows a concrete pattern: build a Swift enum state definition (cases loading data error empty plus an Event enum and mutating handleEvent), wrap it in a state machine class with start and methods like receiveData receiveError reload, use a delegate didChangeState to swap view controllers, and compose child machines (loaded → empty data refresh). Sample projects and code live at bit.ly/statemachines and a 5,000‑line real-world machine proves large machines break easily so composition matters.
AI-written summary · about
chapters (12)
- 0:00Intro
- 0:21School of Swift
- 1:34State Machines in Swift
- 8:06The 2 essential parts of a state machine
- 12:32Part 2: State Machine class
- 15:16Integrating into our app
- 17:24Child State Machines
- 19:55State Definition Enum
- 21:03Onboarding Coordinators
- 21:37Form Validation
- 22:25Accepting Push Notifications
- 23:10Other Resources
related talks
01h 03mUsing State Machines in SwiftUI — Fast, Simple, and Convenient
43mGood Intentions II: Enemy of the State
26mState Driven Development - The Beauty of Enums in Swift
28mState machines for frontend state management
20mSetState, We Need to Talk!
37mState Machine: What It Is and Why
28msetState Machine
38mInto the Visual World of State Machines
