Post

Replies

Boosts

Views

Activity

Updating SwiftUI Views when changing a property of a Core Data object
I have a SwiftUI App project using Core Data. If I add a new object to the database, SwiftUI updates without problem. If I edit an item in the database, the views do not update until they're reloaded. Is there a way to force SwiftUI to update when a property changes, rather than just when an object is added or removed from the database? I have a list showing data from each object in the database, and I originally solved the updating problem by making the object passed to the view an @ObservedObject. This resulted in a crash when the row was deleted, as SwiftUI seemed to be trying to re-render the view before it animated out.
1
0
826
Aug ’20