Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions Sources/SQLiteData/CloudKit/CloudKit+StructuredQueries.swift
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,29 @@
typealias EquatableCKRecordValueProtocol = CKRecordValueProtocol & Equatable

self.userModificationTime = other.userModificationTime
for column in T.TableColumns.writableColumns {
func open<Value>(_ column: some WritableTableColumnExpression<T, Value>) {
_update(
with: other,
row: row,
columnNames: &columnNames,
parentForeignKey: parentForeignKey,
columns: T.TableColumns.writableColumns
)
}

private func _update<T: PrimaryKeyedTable>(
with other: CKRecord,
row: T,
columnNames: inout [String],
parentForeignKey: ForeignKey?,
columns: [any WritableTableColumnExpression]
) {
typealias EquatableCKRecordValueProtocol = CKRecordValueProtocol & Equatable

for column in columns {
func open<Root, Value>(_ column: some WritableTableColumnExpression<Root, Value>) {
let key = column.name
let keyPath = column.keyPath as! KeyPath<T, Value.QueryOutput>
let column = column as! any WritableTableColumnExpression<T, Value>
let keyPath = column.keyPath
let didSet: Bool
if let value = other[key] as? CKAsset {
didSet = setAsset(value, forKey: key, at: other.encryptedValues[at: key])
Expand Down
Loading
Loading