Post

Replies

Boosts

Views

Activity

Why did NSPersistentCloudKitContainer added CKAsset fields for each String in Core Data
Hi, I've been using Core Data + CloudKit via NSPersistentCloudKitContainer for several years now. Back then I just created my Core Data AND CloudKit fields by hand. Now the time has come for a little lightweight migration to a new Core Data model, let's say I just needed to add one String attribute. So I've done the Core Data local migration as usual, then added this to container code: try? persistentContainer.initializeCloudKitSchema(options: NSPersistentCloudKitContainerSchemaInitializationOptions()) Run. And everything worked great. but… Now I've noticed that CloudKit created new CKAsset fields for each String attribute that I had in Core Data (about 5 new CKAsset fields). Is this normal!? Why? ! Is it safe to deploy these changes to prod? ty. ChatGPT said: "This field is used internally by CloudKit to handle large string values. If the string value is small enough, it is stored in the normal String field, but if it exceeds the size limit (about 1KB), the string is automatically stored as a CKAsset."
1
1
185
1w
Laggy scroll inside .fullScreenCover on the iPad
In my iPad app, I have a view that is displayed in .fullScreenCover. And while it's a pretty basic view (a few stacks, some SF Symbols, and long text), the scrolling is sometimes laggy. Like I can see the stutter on my iPad Pro. Since it's WWDC, maybe someone can point me to a tutorial, or the tool, or the steps I can take to tackle this laggy scrolling? Or maybe .fullScreenCovers aren't supposed to be long and be scrolled? Thanks in advance!
1
0
314
Jun ’24
What does "Allows External Storage" checkbox in the Attribute Inspector do?
For a bit of context, I store binary files of about 50KB in my Core Data. I noticed that enabling the "Allows External Storage" option doesn't seem to make any difference. Additionally, how does this setting work with CloudKit when using NSPersistentCloudKitContainer? Does this setting affect how the data is loaded into memory when accessed in Core Data in the app? Thank you very much!
1
0
455
Jun ’24
How to get @FetchRequest respect fetchLimit when new records are added
How can I keep the fetchLimit constant even when new data is inserted? To replicate this, you can create a new Project in Xcode and check "Use Core Data". I use this code to apply fetchLimit: struct MyView: View { @FetchRequest private var items: FetchedResults<Item> init() { let request: NSFetchRequest<Item> = Item.fetchRequest() request.fetchLimit = 3 _items = FetchRequest(fetchRequest: request) } This code works. For example I have 10 Items and when I open the app - only 3 are displayed! But when I add a new Item on the fly - @FetchRequest just adds it to the View and now it displays 4 Items!? How can I make @FetchRequest keep updating the View reactively, but respect the fetchLimit to always show the latest 3 Items only?
1
3
562
Aug ’23