Tristan
banner
tcldr.bsky.social
Tristan
@tcldr.bsky.social
Digital Product Design and Development
Definitely comes down to preference – I'd rather not have the machinery there if I'm not planning on using it. (Although, in practice this is what I'm forced to do.)

The other big issue is that you can't retroactively add Observable to an existing class/3rd party library.
December 9, 2024 at 1:50 PM
Hmmm, I'm not sure it's so clear cut! The alternatives are to a) create a regular EnvironmentValue and force unwrap the reference, or b) Just conform your service to Observable anyway and then hope you remember to opt-out of observation where necessary (which seems equally foot-gun prone!)
December 9, 2024 at 1:32 PM
Yes, I think we're talking about slightly different use cases. I'm talking about something like this:
gist.github.com/tcldr/965510...
SwiftUI Environment Service
SwiftUI Environment Service. GitHub Gist: instantly share code, notes, and snippets.
gist.github.com
December 9, 2024 at 1:28 PM
(To be clear, I’m talking specifically about types/dependencies where you don’t intend to observe any state, just call methods on or pull state in the context of an action.)
December 9, 2024 at 9:24 AM
Shouldn’t do, because even with an Observable reference, changes to the environment reference do seem to cause the view to recompute. AFAICT, this has nothing to do with the Observable type, just the Environment property wrapper doing its job.
December 9, 2024 at 8:39 AM
I’m still not quite sure why we can’t use this mechanism for non-observable reference types, too.
December 8, 2024 at 7:56 PM
They baited the industry flawlessly. Hats off to Jaguar. One for the marketing textbooks.
December 3, 2024 at 11:16 AM