Post

Replies

Boosts

Views

Activity

Reply to SwiftData Model class not triggering observation of computed property that depends on relationship
Update: The bug might not be with SwiftData or Observation framework, but rather in SwiftUI registering tracking for the observable. If I add this to the body above I do get the view updating. Section { Text("Planes departing = \(airport.numberOfAirplanesDeparting)") Text("Planes in flight = \(airport.numberOfAirplanesInFlight)") Text("Planes landing = \(airport.numberOfAirplanesLanding)") } And it updates the text in the footer as well. But with only the 3 Text views in the footer SwiftUI will not update when the airport's computed properties change.
Sep ’23
Reply to SwiftData Model class not triggering observation of computed property that depends on relationship
Update: The bug might not be with SwiftData or Observation framework, but rather in SwiftUI registering tracking for the observable. If I add this to the body above I do get the view updating. Section { Text("Planes departing = \(airport.numberOfAirplanesDeparting)") Text("Planes in flight = \(airport.numberOfAirplanesInFlight)") Text("Planes landing = \(airport.numberOfAirplanesLanding)") } And it updates the text in the footer as well. But with only the 3 Text views in the footer SwiftUI will not update when the airport's computed properties change.
Replies
Boosts
Views
Activity
Sep ’23