Search posts, tags, users, and pages
Xavier
iOS Developer
Model-View-ViewModel (MVVM) is an architectural pattern that has gained a lot of popularity in recent years, especially in the context of developing mobile applications. With the release of SwiftUI, Apple's new framework for building user interfaces,...
Abdurahmon Jamoliddinov
iOS Dev from Kokand
What do you think about using @ObservedObject instead of @StateObject, is it good practice or is it better to use @StateObject?
it depends on the case. State is the source of truth. So use StateObject in views where the data is created/captured. Other views should use ObservedObject to observe the state.
StateObject
ObservedObject
Abdurahmon Jamoliddinov
iOS Dev from Kokand
What do you think about using @ObservedObject instead of @StateObject, is it good practice or is it better to use @StateObject?