Something old, something new


« Mystery Beta

Macros Beta »

Today I want to talk about two books - one is the something old and the other is the something new.

The something old is my book Dear Elena. My youngest daughter died suddenly February 22, 2006 a little over a week before her seventh birthday. The following day I woke up and began writing my thoughts and later gathered the first hundred posts into a book.

Unbelievably, it's been eighteen years since one of the two darkest days in my life. People have written to tell me they have benefitted from the book so I'm linking to the eBook of Dear Elena on Gumroad.

Gumroad is the best way to support my work as Amazon takes most of the price of the book for themselves. If you need, want, a paperback copy of Dear Elena, it is available at Amazon.

As for the something new, I've finished my book on DataFlow in SwiftUI: The Mystery of the Mutating Mannequin (yes, this is the Gumroad link please click to buy here).

This book explores the flow of data in SwiftUI apps From the most basic SwiftUI app through one that uses AsyncStream, Observable, and SwiftData.

Chapter 1 looks at simple views with no state. We focus on how the view is assembled and, in particular, what modifiers add to the view hierarchy.

Chapter 2 introduces state and we look at simple properties and @State and look at when views redraw and why. It's material that we know about SwiftUI but here we have the ability to poke and prod a bit and get to understand the mechanism a little better.

Chapter 3 is an exploration of shared state. We begin with two views that use @Binding to share state and then move to a more robust model that uses @ObservableObject and @Published. We replace this solution that uses Combine with AsyncStreams and then look at @Observable objects (which are not the same as @ObservableObjects) and @Bindable.

Chapter 4 begins with a look at managing and displaying an object graph manually. We move on to Core Data. Wait, why Core Data? Because SwiftData is built on top of Core Data and understanding the concepts covered in Chapter 4 will help you understand and put SwiftData in context.

Chapter 5 is an introduction to SwiftData. You'll learn to create a model which includes one-one, one-many, and many-many relationships. You'll set up the SwiftData stack in the simplest possible way and then set it up and load it with instances of model objects to support the previews. We finish with the basic CRUD operations where you learn to create, read, update, and delete instances and configure the delete rules such that related objects are treated correctly as well.

So those are my something old and something new.

There's also a something next on the way. I've sent the first chapter of my Swift Macros book off to my tech reviewers.