Posts

Post not yet marked as solved
2 Replies
232 Views
I'm having some trouble with the following function from the CKSyncEngineDelegate protocol. func nextRecordZoneChangeBatch(_ context: CKSyncEngine.SendChangesContext, syncEngine: CKSyncEngine) async -> CKSyncEngine.RecordZoneChangeBatch? { The sample code from the documentation is func nextRecordZoneChangeBatch( _ context: CKSyncEngine.SendChangesContext, syncEngine: CKSyncEngine ) async -> CKSyncEngine.RecordZoneChangeBatch? { // Get the pending record changes and filter by the context's scope. let pendingChanges = syncEngine.state.pendingRecordZoneChanges .filter { context.options.zoneIDs.contains($0) } // Return a change batch that contains the corresponding materialized records. return await CKSyncEngine.RecordZoneChangeBatch( pendingChanges: pendingChanges) { self.recordFor(id: $0) } } init?(pendingChanges: [CKSyncEngine.PendingRecordZoneChange], recordProvider: (CKRecord.ID) -> (CKRecord?)) works fine for the sample app which only has one record type, but it seems incredible inefficient for my app which has a dozen different record types. The recordProvider gives you a CKRecord.ID, but not the CKRecord.RecordType. Searching each record type for a matching ID seems very inefficient. Doesn't the CKSyncEngine.PendingRecordZoneChange contain an array of CKRecords, not just CKRecord.IDs? According to the documentation CKSyncEngine.RecordZoneChangeBatch has a recordsToSave property, but Xcode reports 'CKSyncEngine.PendingRecordZoneChange' has no member 'recordsToSave' I'm looking for someway to get the CKRecords from syncEngine.state.pendingRecordZoneChanges.
Posted
by adamek.
Last updated
.
Post not yet marked as solved
10 Replies
1.6k Views
In Xcode Version 15.0 beta (15A5160n) this predicate will not build: let thisPredicate = #Predicate<Ledgers> { ($0.myStore != nil) } The definition of .myStore in the Ledgers class is: var myStore: Stores? an optional relationship. Is there anyway to test for nil optional relationships in SwiftData? The inverse relationship in Stores is: @Relationship(.deny, inverse: \Ledgers.myStore) var myReceipts: [Ledgers]
Posted
by adamek.
Last updated
.
Post not yet marked as solved
3 Replies
1.9k Views
Consider the Categories class below. Without the @Model line, Xcode has no problems. As soon as the @Model line is added, Xcode protests that the class does not conform to Decodable or Encodable. Apparently the @Model macro expanded macro prevents the implied boilerplate that the systems adds when the Codable protocol is added to the class. I've filed feedback (FB12444837) for this. Does anyone have suggestions that will let me avoid the boilerplate? This is the simplest class in my schema, I've got 12 other classes with many more variables. @Model class Categories: Identifiable, Codable { // MARK: Identifiable var id: UUID { return uuidKey } // MARK: - Properties @Attribute(.unique) var uuidKey: UUID = UUID() var dateCreated: Date = Date() var dateModified: Date = Date() var dateRealm: Date? = nil var uuidUser: UUID = UUID() var uuidFamily: UUID = UUID() var myName: String = "" }
Posted
by adamek.
Last updated
.
Post not yet marked as solved
0 Replies
585 Views
I'm getting the following message a lot in my app's output log. Cannot parse config agent (NSPPrivacyProxyDNSAgent). No data available Is this some consequence of Private Relay? Running Xcode Version 13.0 beta (13A5154h)
Posted
by adamek.
Last updated
.
Post not yet marked as solved
0 Replies
487 Views
Last year's Combine presentations suffered from being shown in very early beta SwiftUI and IOS13. I was hoping for some updated Combine sessions this year.
Posted
by adamek.
Last updated
.