@dimillian @IceCubesApp never thought to embed app storage in an observable object before. How do you go about accessing them outside the view, or do you not need to?
@phill @dimillian @IceCubesApp unfortunately AppStorage does not currently work in Observable on iOS 17.
@alpennec @phill @IceCubesApp actually observable is for some other published properties on there. AppStorage not working as published property on iOS 17 would be crazy. I guess it’s a bug? Also I’ve made it a singleton to access it anywhere else than in views.
@dimillian @alpennec @IceCubesApp that's neat, thanks for sharing.
I went down the route of mimicking environment keys, which works great, but not sure it was worth all the time/effort replicating AppStorage 😛
@phill @alpennec @IceCubesApp so you inject all of them at the app level and then retrieve like env?
@dimillian @alpennec @IceCubesApp I used to use the environment exclusively (2nd photo), but views weren't notified of changes. This was fine for most of my views, but some needed to be live.
For these I have a @Setting property wrapper mapped to a StateObject that listens for changes in the defaults. I switch between the two depending on what I need, but they all utilise the same keys.
@phill @dimillian @IceCubesApp can you share the Setting property wrapper?
@dimillian @phill @IceCubesApp I also hope it’s a bug, I read it here (Hidde shared it multiple times): https://mastodon.design/@hidde/110694424081107663
@phill @dimillian @IceCubesApp I’ve poked around the source a little, it’s a masterclass! And I loved putting app storage in an observable, quite neat