From f24f4e350629f5a112df6ad4ba0c3b94cb96ce65 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Wed, 29 Oct 2025 23:19:14 -0700 Subject: [PATCH 1/4] 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. --- .../SQLiteData/CloudKit/CloudKit+StructuredQueries.swift | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Sources/SQLiteData/CloudKit/CloudKit+StructuredQueries.swift b/Sources/SQLiteData/CloudKit/CloudKit+StructuredQueries.swift index 3c040270..6e9eacd9 100644 --- a/Sources/SQLiteData/CloudKit/CloudKit+StructuredQueries.swift +++ b/Sources/SQLiteData/CloudKit/CloudKit+StructuredQueries.swift @@ -3,12 +3,12 @@ import CryptoKit import StructuredQueriesCore - extension _CKRecord where Self == CKRecord { + extension CKRecord { public typealias _AllFieldsRepresentation = SQLiteData._AllFieldsRepresentation public typealias SystemFieldsRepresentation = _SystemFieldsRepresentation } - extension _CKRecord where Self == CKShare { + extension CKShare { public typealias _AllFieldsRepresentation = SQLiteData._AllFieldsRepresentation public typealias SystemFieldsRepresentation = _SystemFieldsRepresentation } @@ -102,10 +102,6 @@ private struct DecodingError: Error {} } - extension CKRecord: _CKRecord {} - - public protocol _CKRecord {} - extension CKDatabase.Scope { public struct RawValueRepresentation: QueryBindable, QueryRepresentable { public let queryOutput: CKDatabase.Scope From 00897f1d7e73aa7d9a99997cab6827c690147939 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 30 Oct 2025 11:51:19 -0500 Subject: [PATCH 2/4] Compile time tests --- .../xcshareddata/swiftpm/Package.resolved | 20 ++++++++++++- Tests/SQLiteDataTests/CompileTimeTests.swift | 30 +++++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index a0d54872..587d0c8d 100644 --- a/Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Examples/Examples.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "c133bf7d10c8ce1e5d6506c3d2f080eac8b4c8c2827044d53a9b925e903564fd", + "originHash" : "41e7781e6c506773b6af84af513bcd6d3b1be59d635e6c4c4bd89638368e4629", "pins" : [ { "identity" : "combine-schedulers", @@ -73,6 +73,24 @@ "version" : "1.9.4" } }, + { + "identity" : "swift-docc-plugin", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-docc-plugin", + "state" : { + "revision" : "3e4f133a77e644a5812911a0513aeb7288b07d06", + "version" : "1.4.5" + } + }, + { + "identity" : "swift-docc-symbolkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swiftlang/swift-docc-symbolkit", + "state" : { + "revision" : "b45d1f2ed151d057b54504d653e0da5552844e34", + "version" : "1.0.0" + } + }, { "identity" : "swift-identified-collections", "kind" : "remoteSourceControl", diff --git a/Tests/SQLiteDataTests/CompileTimeTests.swift b/Tests/SQLiteDataTests/CompileTimeTests.swift index 252a3795..3ac9b716 100644 --- a/Tests/SQLiteDataTests/CompileTimeTests.swift +++ b/Tests/SQLiteDataTests/CompileTimeTests.swift @@ -7,3 +7,33 @@ private final class Model { _titles = FetchAll(Reminder.select(\.title)) } } + +@Table +struct RepresentableFields { + @Column(as: CKShare.SystemFieldsRepresentation.self) + var share: CKShare + @Column(as: CKShare?.SystemFieldsRepresentation.self) + var optionalShare: CKShare? + @Column(as: CKRecord.SystemFieldsRepresentation.self) + var record: CKRecord + @Column(as: CKRecord?.SystemFieldsRepresentation.self) + var optionalRecord: CKRecord? +} + +@DatabaseFunction( + as: ( + ( + CKShare.SystemFieldsRepresentation, + CKRecord.SystemFieldsRepresentation, + CKShare?.SystemFieldsRepresentation, + CKRecord?.SystemFieldsRepresentation + ) -> Void + ).self +) +nonisolated func representableArguments( + share: CKShare, + record: CKRecord, + optionalShare: CKShare?, + optionalRecord: CKRecord? +) { +} From c6cbdbae6b2b1f62be49aa675f7aa4a2346b3b6d Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 30 Oct 2025 12:29:50 -0500 Subject: [PATCH 3/4] wip; --- Tests/SQLiteDataTests/CompileTimeTests.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Tests/SQLiteDataTests/CompileTimeTests.swift b/Tests/SQLiteDataTests/CompileTimeTests.swift index 3ac9b716..39fc2df3 100644 --- a/Tests/SQLiteDataTests/CompileTimeTests.swift +++ b/Tests/SQLiteDataTests/CompileTimeTests.swift @@ -1,3 +1,4 @@ +import CloudKit import SQLiteData private final class Model { From ae0a29cc5908e992b1bf1577ac17fdb9c85abc6f Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 30 Oct 2025 12:30:31 -0500 Subject: [PATCH 4/4] wip --- Tests/SQLiteDataTests/CompileTimeTests.swift | 53 +++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/Tests/SQLiteDataTests/CompileTimeTests.swift b/Tests/SQLiteDataTests/CompileTimeTests.swift index 39fc2df3..0a080bb9 100644 --- a/Tests/SQLiteDataTests/CompileTimeTests.swift +++ b/Tests/SQLiteDataTests/CompileTimeTests.swift @@ -1,6 +1,9 @@ -import CloudKit import SQLiteData +#if canImport(CloudKit) + import CloudKit +#endif + private final class Model { @FetchAll var titles: [String] @@ -9,32 +12,32 @@ private final class Model { } } -@Table -struct RepresentableFields { - @Column(as: CKShare.SystemFieldsRepresentation.self) - var share: CKShare - @Column(as: CKShare?.SystemFieldsRepresentation.self) - var optionalShare: CKShare? - @Column(as: CKRecord.SystemFieldsRepresentation.self) - var record: CKRecord - @Column(as: CKRecord?.SystemFieldsRepresentation.self) - var optionalRecord: CKRecord? -} +#if canImport(CloudKit) + @Table + struct RepresentableFields { + @Column(as: CKShare.SystemFieldsRepresentation.self) + var share: CKShare + @Column(as: CKShare?.SystemFieldsRepresentation.self) + var optionalShare: CKShare? + @Column(as: CKRecord.SystemFieldsRepresentation.self) + var record: CKRecord + @Column(as: CKRecord?.SystemFieldsRepresentation.self) + var optionalRecord: CKRecord? + } -@DatabaseFunction( - as: ( - ( + @DatabaseFunction( + as: (( CKShare.SystemFieldsRepresentation, CKRecord.SystemFieldsRepresentation, CKShare?.SystemFieldsRepresentation, CKRecord?.SystemFieldsRepresentation - ) -> Void - ).self -) -nonisolated func representableArguments( - share: CKShare, - record: CKRecord, - optionalShare: CKShare?, - optionalRecord: CKRecord? -) { -} + ) -> Void).self + ) + nonisolated func representableArguments( + share: CKShare, + record: CKRecord, + optionalShare: CKShare?, + optionalRecord: CKRecord? + ) { + } +#endif