Skip to content

Commit b66b894

Browse files
Fix issues with CK{Record,Share}.SystemFieldsRepresentation (#284)
* Fix issues with `CK{Record,Share}.SystemFieldsRepresentation` I'm a little surprised that this diff fixes things, but it does locally for me, in the latest Xcode 26, so let's test this change a bit before merging. * Compile time tests * wip; * wip --------- Co-authored-by: Brandon Williams <[email protected]>
1 parent 88b419e commit b66b894

File tree

2 files changed

+36
-6
lines changed

2 files changed

+36
-6
lines changed

Sources/SQLiteData/CloudKit/CloudKit+StructuredQueries.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import CryptoKit
44
import StructuredQueriesCore
55

6-
extension _CKRecord where Self == CKRecord {
6+
extension CKRecord {
77
public typealias _AllFieldsRepresentation = SQLiteData._AllFieldsRepresentation<CKRecord>
88
public typealias SystemFieldsRepresentation = _SystemFieldsRepresentation<CKRecord>
99
}
1010

11-
extension _CKRecord where Self == CKShare {
11+
extension CKShare {
1212
public typealias _AllFieldsRepresentation = SQLiteData._AllFieldsRepresentation<CKShare>
1313
public typealias SystemFieldsRepresentation = _SystemFieldsRepresentation<CKShare>
1414
}
@@ -102,10 +102,6 @@
102102
private struct DecodingError: Error {}
103103
}
104104

105-
extension CKRecord: _CKRecord {}
106-
107-
public protocol _CKRecord {}
108-
109105
extension CKDatabase.Scope {
110106
public struct RawValueRepresentation: QueryBindable, QueryRepresentable {
111107
public let queryOutput: CKDatabase.Scope
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,43 @@
11
import SQLiteData
22

3+
#if canImport(CloudKit)
4+
import CloudKit
5+
#endif
6+
37
private final class Model {
48
@FetchAll var titles: [String]
59

610
init() {
711
_titles = FetchAll(Reminder.select(\.title))
812
}
913
}
14+
15+
#if canImport(CloudKit)
16+
@Table
17+
struct RepresentableFields {
18+
@Column(as: CKShare.SystemFieldsRepresentation.self)
19+
var share: CKShare
20+
@Column(as: CKShare?.SystemFieldsRepresentation.self)
21+
var optionalShare: CKShare?
22+
@Column(as: CKRecord.SystemFieldsRepresentation.self)
23+
var record: CKRecord
24+
@Column(as: CKRecord?.SystemFieldsRepresentation.self)
25+
var optionalRecord: CKRecord?
26+
}
27+
28+
@DatabaseFunction(
29+
as: ((
30+
CKShare.SystemFieldsRepresentation,
31+
CKRecord.SystemFieldsRepresentation,
32+
CKShare?.SystemFieldsRepresentation,
33+
CKRecord?.SystemFieldsRepresentation
34+
) -> Void).self
35+
)
36+
nonisolated func representableArguments(
37+
share: CKShare,
38+
record: CKRecord,
39+
optionalShare: CKShare?,
40+
optionalRecord: CKRecord?
41+
) {
42+
}
43+
#endif

0 commit comments

Comments
 (0)