Relative Content

Tag Archive for swiftswiftuiswiftdata

SwiftData mode does not update the view when I insert child records

I have a problem with SwiftData and inserting child records. The insert itself works but the views are not updated. If I add a new court record in DetailView, tournament.title in ContentView changes to Tournament with new court but tournament.courts.count is still 1 and not 2, 3, … Also the List in DetailView shows only the initial court and not the new added.

Storing and Retrieving RGB with SwiftData

I am out of ideas. I am trying to have a color theme picker in a view that would allow selection of predefined color theme values, store it in SwiftData as persistent storage and then use it throughout the app.

View not updating when relationship array changes

I’m working on a SwiftUI app using SwiftData for persistence. I have a TaskModel class with a relationship to DailyProgress objects. When I update the progress, the view doesn’t reflect the changes. Here’s an example to demonstrate: (You can just copy everything)

View not updating when relationship array changes

I’m working on a SwiftUI app using SwiftData for persistence. I have a TaskModel class with a relationship to DailyProgress objects. When I update the progress, the view doesn’t reflect the changes. Here’s an example to demonstrate: (You can just copy everything)

How to combine two Different models into Model container

I have two models that don’t have a relationship and I am attempting to combine them into a model container then insert some dummy data into one but I am getting a fatal error “failed to configure SwiftData container”: