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)
Topic: App & System Services SubTopic: iCloud Tags:
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) } } }
Topic: App & System Services SubTopic: iCloud Tags:
May ’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.
Topic: App & System Services SubTopic: iCloud Tags:
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)
Topic: App & System Services SubTopic: iCloud Tags:
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) } } }
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
May ’23