sindresorhus / Plash

💦 Make any website your Mac desktop wallpaper

Home Page:https://sindresorhus.com/plash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftUI question

godbout opened this issue · comments

commented

just curious about your code. it's obviously beautiful and i'm 100% certain that you know way more than me what you're doing. and i'm trying to learn from the best. so. the question: what's the advantage of using a @StateObject that holds the AppState singleton rather than just using the singleton directly within the SwiftUI views?

hope my question makes sense. thanks in advance for the time you may spend on this.

Future-proofing. If I add any @Published properties, it will just work without having to change a lot of code.

commented

thank you Sir. makes total sense. i don't have much SwiftUI stuff in my apps (just the Settings) so yeah, didn't catch this. kòp kun kráp!