All Questions
18
questions
-1
votes
0
answers
32
views
Read SwiftData store metadata using Core Data
I need to access store metadata, like version identifiers (NSStoreModelVersionIdentifiers). The starting point is a SwiftData stack, so I have my instance of ModelContainer and my ModelConfiguration. ...
1
vote
0
answers
63
views
Why does SwiftData hang when using a predicate?
For some reason, when using a predicate, my app freezes and hangs. It works fine with just @Query private var items: [Item]
If you use the following arguments when running the app:
-com.apple....
-1
votes
1
answer
32
views
Any way to override or influence the sqlite generated table names used by SwiftData/CoreData?
I have a SwiftData model that has a few many-to-many relationships that require an intersection table.
My question relates to how the intersection tables are automatically named in sqlite.
My model ...
0
votes
0
answers
165
views
SwiftUI Lag on Core Data/SwiftData Updates During Background Tasks
I'm experiencing UI lag in SwiftUI when updating Core Data or SwiftData entities in the background, noticeable during scrolling. This issue arises regardless of whether the updated entity is currently ...
2
votes
1
answer
758
views
SwiftData: How to detect when CloudKit synced (or is about to sync) new data
Two things:
How do I detect when SwiftData with CloudKit finished syncing new data from somewhere else?
How do I detect if there are changes that still need to be synced?
Some background:
There ...
0
votes
0
answers
184
views
How to make SwiftData document-based app coexist with Core Data using same persistent container from the document
I am working on a SwiftData document-based app. Most things were progressing pretty well until I tried to build more complicated predicates; specifically the lack of NSCompoundPredicate-like support ...
0
votes
0
answers
85
views
Migrate CoreData enum to SwiftData
I have a simple CoreData object that includes an enum, and when I try to migrate to SwiftData the data is removed and the app crashes. How can this be avoided? I feel like the automatic migration ...
6
votes
1
answer
2k
views
SwiftData: Is using Model().id is fine or is it necessary to make a model attribute unique?
A beginner here
I have seen that a SwiftData model has an id property which is a PersistentIdentifier.
https://developer.apple.com/documentation/swiftdata/persistentidentifier
Currently I don't use an ...
0
votes
2
answers
688
views
Accessing data in SwiftData in SwiftUI
I'm trying to understand and learn SwiftData. I want to keep some data in my application. I wanted to use swiftData to learn SwiftData and created a model like this:
import Foundation
import SwiftData
...
0
votes
0
answers
180
views
iOS App Architecture : Networking vs. Saving to Core Data/SwiftData
Background: Im building an iOS Bus scheduling app. I'm getting Bus Schedule and Bus Route information from a public API. The Bus Route information is large (25000 JSON records).
Challenge: Initially I ...
1
vote
0
answers
870
views
SwiftData insert Relationship large array
I'm trying to use SwiftData with a large amount of objects and it seems there is very bad performance when inserting items.
For example I have a child model that looks like below. Notice I didn't set ...
2
votes
1
answer
707
views
SwiftData with ValueTransformer similar to core data
In Core Data, you are able to use ValueTransformer to transform individual attributes to/from core data. This would be useful in cases like encrypting/decrypting certain attributes when storing/...
3
votes
0
answers
701
views
Observe property changes of all objects in SwiftData
In Core Data you can do something like this to observe property changes of all objects of a type:
.onReceive(NotificationCenter.default
.publisher(for: .NSManagedObjectContextObjectsDidChange)
) { ...
1
vote
1
answer
756
views
SwiftData share extension blocks app from opening SQLite file
Using SwiftData and a shared SQLite database in an app and its share extension. If you merely tap Share in Safari, and the extension is shown, when you activate the app, one view throws:
DraftsView : ...
0
votes
0
answers
75
views
Swift Data support to NSExpression
Does swiftData support NSExpression or any way to do min/max and sum operations. Like in coreCata ,
let keypathExp1 = NSExpression(forKeyPath: "col")
let expression = NSExpression(...