Post

Replies

Boosts

Views

Activity

Reply to Sharing data with SwiftData
Initialize your ModelConfiguration with your cloudKitContainerIdentifier. init( _ name: String? = nil, schema: Schema? = nil, url: URL, readOnly: Bool = false, cloudKitContainerIdentifier: String? = nil ) See here for details. [https://developer.apple.com/documentation/swiftdata/modelconfiguration/init(_:schema:url:readonly:cloudkitcontaineridentifier:)?changes=_2_10)
Jun ’23
Reply to CKQuery with NSPredicate fails when using “CONTAINS” operator
I had the same issue. What I wound up doing is creating a "filter" function which iterated through the CKRecords and removed records which did not match my search criteria. Here's the business part of that code. guard var records = theRecords else {return nil} for (index, record) in records.enumerated().reversed() { if let keyResult = record[keyWord] as? String { let resultString = keyResult.lowercased() if !resultString.contains(searchWord.lowercased()) { records.remove(at: index) } } }
May ’23
Reply to CKAssets Download Even When desiredKeys Excludes Them
The issue is fixed. What was the problem? I had another line of code following the records line in which I did not set desiredKeys. Here's the line of code. let (continuingMatchResults, cMatchCursor) = try await database.records(continuingMatchFrom: queryCursor!) Oince I changed it to let (continuingMatchResults, cMatchCursor) = try await database.records(continuingMatchFrom: queryCursor!, desiredKeys: desiredKeys) all was well.
May ’23
Reply to Core Data Plus CloudKit - Potential Issue / Question about Binary Data w/ External Storage
I know it's great for those new to Core Data and CloudKit for the system to automatically create record fields in CloudKit, but in this case, I wish I had control over the result to define this piece of binary data as a CKAsset in CloudKit. I will never manipulate the CloudKit data directly, but it would be nice to have consistency in the linking of Core Data binary data to CloudKit fields.
Apr ’23
Reply to Notifications not working on ModelContext
Try this in your view controller to observe remote change notifications. NotificationCenter.default.addObserver(self, selector: #selector(updateView(_ :)), name: .NSPersistentStoreRemoteChange, object: nil)
Replies
Boosts
Views
Activity
Jul ’23
Reply to CKSyncEngine & SwiftData
I've converted a version of my UIKit app to use SwiftData and CloudKit from CoreData/CloudKit. It works and the apps are syncing, but I am having a problem getting a notification when the data changes so I can update my view.
Replies
Boosts
Views
Activity
Jun ’23
Reply to Sharing data with SwiftData
Initialize your ModelConfiguration with your cloudKitContainerIdentifier. init( _ name: String? = nil, schema: Schema? = nil, url: URL, readOnly: Bool = false, cloudKitContainerIdentifier: String? = nil ) See here for details. [https://developer.apple.com/documentation/swiftdata/modelconfiguration/init(_:schema:url:readonly:cloudkitcontaineridentifier:)?changes=_2_10)
Replies
Boosts
Views
Activity
Jun ’23
Reply to Notifications not working on ModelContext
Your object is set to nil, but shouldn't it be set to ModelContext context?
Replies
Boosts
Views
Activity
Jun ’23
Reply to Xcode 15 beta - Only one native Mac app can be added to the App Store
Feedback made: FB12313651
Replies
Boosts
Views
Activity
Jun ’23
Reply to Xcode 15 beta - Only one native Mac app can be added to the App Store
I'm filling a bug report on this.
Replies
Boosts
Views
Activity
Jun ’23
Reply to CKQuery with NSPredicate fails when using “CONTAINS” operator
I had the same issue. What I wound up doing is creating a "filter" function which iterated through the CKRecords and removed records which did not match my search criteria. Here's the business part of that code. guard var records = theRecords else {return nil} for (index, record) in records.enumerated().reversed() { if let keyResult = record[keyWord] as? String { let resultString = keyResult.lowercased() if !resultString.contains(searchWord.lowercased()) { records.remove(at: index) } } }
Replies
Boosts
Views
Activity
May ’23
Reply to CKAssets Download Even When desiredKeys Excludes Them
The issue is fixed. What was the problem? I had another line of code following the records line in which I did not set desiredKeys. Here's the line of code. let (continuingMatchResults, cMatchCursor) = try await database.records(continuingMatchFrom: queryCursor!) Oince I changed it to let (continuingMatchResults, cMatchCursor) = try await database.records(continuingMatchFrom: queryCursor!, desiredKeys: desiredKeys) all was well.
Replies
Boosts
Views
Activity
May ’23
Reply to CKAssets Download Even When desiredKeys Excludes Them
The Apple document on CKAsset states the following. "If you don’t require the asset when retrieving records, use the operation’s desiredKeys property to exclude the field." But this doesn't work, at least for the function var (matchResults, queryCursor) = try await database.records(matching: query, desiredKeys: desiredKeys)
Replies
Boosts
Views
Activity
May ’23
Reply to CKAssets Download Even When desiredKeys Excludes Them
Any thoughts from anybody?
Replies
Boosts
Views
Activity
May ’23
Reply to iPad Pro M2 vs xcode
Use Swift Playgrounds on an iPad. Use Xcode on a Mac.
Replies
Boosts
Views
Activity
May ’23
Reply to Update Watch Complication with CloudKit
When you use the WatchConnectivityManager, do you update the applicationContext on the main thread? If not, that may be part of your connectivity problem.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’23
Reply to Deleting then Replacing CKRecords of a Certain Type - Mixed Results
I've decided to use Core Data with CloudKit for the user's private data.
Replies
Boosts
Views
Activity
Apr ’23
Reply to Core Data Plus CloudKit - Potential Issue / Question about Binary Data w/ External Storage
I know it's great for those new to Core Data and CloudKit for the system to automatically create record fields in CloudKit, but in this case, I wish I had control over the result to define this piece of binary data as a CKAsset in CloudKit. I will never manipulate the CloudKit data directly, but it would be nice to have consistency in the linking of Core Data binary data to CloudKit fields.
Replies
Boosts
Views
Activity
Apr ’23
Reply to Core Data Plus CloudKit - Potential Issue / Question about Binary Data w/ External Storage
I'm running the app in the Development environment and have not committed the CloudKit Schema to the Production environment.
Replies
Boosts
Views
Activity
Apr ’23