Michael Long
Dec 29, 2024

--

Actors can help, but complicate matters at the call site.

And that's NOT what @Observable is used for.

Then, after telling us how singleton patterns are bad, you implement demonstrate how to create multiple singletons per module.

You really need to go back and read what the singleton pattern actually is and why it's actually used. Singletons are used to control access to a single resource, and guard against multiple instances of those resources being created.

Swift 6 is also going to complain about that global var, btw..

--

--

Michael Long
Michael Long

Written by Michael Long

I write about Apple, Swift, and SwiftUI in particular, and technology in general. I'm also a Lead iOS Engineer at InRhythm, a modern digital consulting firm.

Responses (1)