3 ms·
> You could reduce the number of State variables using one or more shared state objects and access via environment at certain points in the view hierarchy. Jus
by MrGando 5y ago
> You could reduce the number of State variables using one or more shared state objects and access via environment at certain points in the view hierarchy.
Just a personal opinion here, but those shared state objects and SwiftUI + glorified singletons really hurts every time I see it. It's so prevalent in online tutorials like Ray Wenderlich and the such.
Honestly, it's hard to avoid and can be done but requires a significant effort. I was hoping for Apple to come up with a more elegant solution during WWDC 21 but so far I haven't seen anything to improve this situation.