Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
Best practices
0 votes
3 replies
70 views

In SwiftData / CloudKit, when you have a root model object, it's pretty straightforward when you want to add or delete it from the model: simply use a modelContext variable and use its insert and ...
0 votes
0 answers
35 views

My application contains two different databases. The first contains information that does not change and will be distributed in the app's bundle. The second contains information that can be edited and ...
0 votes
1 answer
318 views

I started getting this error, and I can't figure out why. I have attached a modelContainer to my main WindowGroup, and I have other views that use the @Query property and they work fine, but for some ...
0 votes
1 answer
149 views

Edit with minimal reproducible example: @main struct SwiftDataTestApp: App { var sharedModelContainer: ModelContainer = { let schema = Schema([ Team.self, Player.self ])...
0 votes
0 answers
70 views

I don't know how do I write a migration plan for this if it's required, is this a lightweight migration or a complex migration @Model class ParkModel { var items: [String]? init(items: [...
1 vote
1 answer
282 views

Definitely one of the stranger quirks of SwiftData I've come across. I have a ScriptView that shows Line entities related to a Production, and a TextEnterScriptView that’s presented in a sheet to ...
1 vote
0 answers
132 views

I'm developing an iOS app with SwiftData and modern Swift concurrency using ModelActors. In my app I have two distinct model containers: Main Container: Holds UI‐relevant models. Queue Container: ...
1 vote
1 answer
606 views

SwiftData delete isn't working, when I attempt to delete a model, my app crashes and I get the following error: SwiftData/PersistentModel.swift:359: Fatal error: Cannot remove My_App.Model2 from ...
2 votes
1 answer
538 views

I've been stuck on this for the past week and I'm asking here out of desperation. I have a project using Swift 5, and I recently enabled "Strict Concurrency Checking" to "Complete" so I can slowly ...
0 votes
0 answers
19 views

New to data persistence and I'm trying to improve the performance of an app that uses SwiftData. I profiled the app in Instruments, and I saw a lot of data / relationship faults. What are they and how ...
0 votes
1 answer
106 views

I think my understanding of ModelActor is wrong... I thought ModelActors are used to perform database actions that we don't want to run on the main thread and lock up the UI. Are there any specific ...
0 votes
2 answers
566 views

So, since I updated to Xcode 16.1 and iOS 18, my SwiftData project who relies on autosave doesn't work as expected. Indeed, it works but only after a delay, around 30 seconds. So if I add something to ...
3 votes
1 answer
350 views

Hello, I'm trying to unit test a SwiftData Model, but I'm facing a weird situation and couldn't find an answer to the problem. The first solution I'll show you does not work, the second one does. ...
-1 votes
2 answers
228 views

import SwiftUI import SwiftData struct ItemListView: View { @Bindable var luggage: Luggage @Environment(\.modelContext) var modelContext @State private var selectedItem: Item? ...
1 vote
0 answers
94 views

I’m using Swift Data and CloudKit, with a private container. When developing my understanding is that you should have a target with com.apple.developer.icloud-container-environment key set to "...

15 30 50 per page
1
2 3

AltStyle によって変換されたページ (->オリジナル) /