The Mystery of the Mutating Mannequin


An Exploration of DataFlow in SwiftUI

The Mystery of the Mutating Mannequin

"The Mystery of the Mutating Mannequin" is a fun fast-moving tour of the different techniques of flowing data through your SwiftUI app.

We start with the simplest of views that contains no state, to those that use simple properties, @State properties, or share state using @Binding. Throughout this journey through things you thought you knew, we use various tools to see which views are redrawn when and why.

Next, we manage and persist an object graph manually or go old school with Core Data on your way to learning about the future when we work with SwiftData.

Updated for Xcode 15 and Swift 5.9 and tested on Apple Silicon.

Contents


Chapter 1: Simple Views

Through the Window Display

We Begin

Modifiers

Composition

Road Map

Credits

Chapter 2: View Identity

A Simple Model

Stored Properties

State and Memory

State and Identity

Changing State

Adding a Conditional

Identity

Chapter 3: Sharing State

Binding

Introducing Journey

More Bindings

ObservableObject

Environment

AsyncSequence

Observable

Bindable

Binding and Bindable

Chapter 4: Saving our Work

Multiple Journeys

Persistence

Amuse Bouche

The Stack

The Managed Object Model

Core Data Relationships

Custom Classes

Full Circle-ish and Beyond

Chapter 5: SwiftData

Related


DataFlow in SwiftUI Training from Dim Sum Thinking