Post

Replies

Boosts

Views

Activity

Reply to Sample code shown in video uses @State instead of @StateObject?
Haven't watched the session yet but if it's a value type, @State is correct and it wont get regenerated on each init or each body call. If it's an ObservableObject, then you'd be correct in choosing @StateObject (or @ObservedObject if someone outside of the SwiftUI view hierarchy owns the object.)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jun ’21