Skip to content

Commit 45a7a19

Browse files
authored
Fix Xcode 16 builds (#346)
* Fix Xcode 16 builds We need to gate a CKError check behind a compiler branch. * wip * format
1 parent e767e4b commit 45a7a19

19 files changed

Lines changed: 91 additions & 71 deletions

File tree

Examples/Reminders/RemindersListForm.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct RemindersListForm: View {
7979
await withErrorReporting {
8080
try await database.write { db in
8181
let remindersListID =
82-
try RemindersList
82+
try RemindersList
8383
.upsert { remindersList }
8484
.returning(\.id)
8585
.fetchOne(db)

Examples/Reminders/Schema.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func appDatabase() throws -> any DatabaseWriter {
255255
)
256256
.execute(db)
257257
}
258-
258+
259259
try migrator.migrate(database)
260260

261261
try database.write { db in
@@ -542,4 +542,3 @@ nonisolated private let logger = Logger(subsystem: "Reminders", category: "Datab
542542
}
543543
}
544544
#endif
545-

Examples/Reminders/SearchReminders.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ class SearchRemindersModel {
6767
try database.write { db in
6868
try Reminder
6969
.where {
70-
$0.isCompleted && $0.id.in(
71-
baseQuery(searchText: searchText, searchTokens: searchTokens).select { $1.id }
72-
)
70+
$0.isCompleted
71+
&& $0.id.in(
72+
baseQuery(searchText: searchText, searchTokens: searchTokens).select { $1.id }
73+
)
7374
}
7475
.where {
7576
if let monthsAgo {
@@ -264,7 +265,7 @@ struct SearchRemindersView: View {
264265
}
265266
}
266267

267-
nonisolated fileprivate func baseQuery(
268+
nonisolated private func baseQuery(
268269
searchText: String,
269270
searchTokens: [SearchRemindersModel.Token]
270271
) -> SelectOf<ReminderText, Reminder> {

Examples/SyncUps/App.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class AppModel {
3737
private func bind() {
3838
for destination in path {
3939
switch destination {
40-
case let .detail(detailModel):
40+
case .detail(let detailModel):
4141
bindDetail(model: detailModel)
4242

4343
case .meeting, .record:
@@ -64,11 +64,11 @@ struct AppView: View {
6464
SyncUpsList(model: model.syncUpsList)
6565
.navigationDestination(for: AppModel.Path.self) { path in
6666
switch path {
67-
case let .detail(model):
67+
case .detail(let model):
6868
SyncUpDetailView(model: model)
69-
case let .meeting(meeting, attendees: attendees):
69+
case .meeting(let meeting, attendees: let attendees):
7070
MeetingView(meeting: meeting, attendees: attendees)
71-
case let .record(model):
71+
case .record(let model):
7272
RecordMeetingView(model: model)
7373
}
7474
}

Examples/SyncUps/Dependencies/SpeechClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private actor Speech {
154154
let speechRecognizer = SFSpeechRecognizer(locale: Locale(identifier: "en-US"))!
155155
recognitionTask = speechRecognizer.recognitionTask(with: request) { result, error in
156156
switch (result, error) {
157-
case let (.some(result), _):
157+
case (.some(let result), _):
158158
continuation.yield(SpeechRecognitionResult(result))
159159
case (_, .some):
160160
continuation.finish(throwing: error)

Sources/SQLiteData/CloudKit/Internal/Triggers.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@
371371
zoneNameOverride = #sql("NULL")
372372
ownerNameOverride = #sql("NULL")
373373
}
374-
return parentForeignKey
374+
return
375+
parentForeignKey
375376
.map { foreignKey in
376377
let parentRecordPrimaryKey = #sql(
377378
#"\#(type(of: alias).QueryValue.self).\#(quote: foreignKey.from)"#,
@@ -385,8 +386,12 @@
385386
return (
386387
parentRecordPrimaryKey,
387388
parentRecordType,
388-
#sql("coalesce(\(zoneNameOverride), \($currentZoneName()), (\(parentMetadata.select(\.zoneName))))"),
389-
#sql("coalesce(\(ownerNameOverride), \($currentOwnerName()), (\(parentMetadata.select(\.ownerName))))")
389+
#sql(
390+
"coalesce(\(zoneNameOverride), \($currentZoneName()), (\(parentMetadata.select(\.zoneName))))"
391+
),
392+
#sql(
393+
"coalesce(\(ownerNameOverride), \($currentOwnerName()), (\(parentMetadata.select(\.ownerName))))"
394+
)
390395
)
391396
}
392397
?? (

Sources/SQLiteData/CloudKit/SyncEngine.swift

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,16 +1735,19 @@
17351735
syncEngine.state.add(pendingRecordZoneChanges: [.deleteRecord(failedRecordID)])
17361736
break
17371737
case .networkFailure, .networkUnavailable, .zoneBusy, .serviceUnavailable,
1738-
.notAuthenticated, .operationCancelled, .internalError, .partialFailure,
1739-
.badContainer, .requestRateLimited, .missingEntitlement, .invalidArguments,
1740-
.resultsTruncated, .assetFileNotFound, .assetFileModified, .incompatibleVersion,
1741-
.constraintViolation, .changeTokenExpired, .badDatabase, .quotaExceeded,
1742-
.limitExceeded, .userDeletedZone, .tooManyParticipants, .alreadyShared,
1743-
.managedAccountRestricted, .participantMayNeedVerification, .serverResponseLost,
1744-
.assetNotAvailable, .accountTemporarilyUnavailable, .permissionFailure,
1745-
.unknownItem, .serverRecordChanged, .serverRejectedRequest, .zoneNotFound,
1746-
.participantAlreadyInvited:
1738+
.notAuthenticated, .operationCancelled, .internalError, .partialFailure,
1739+
.badContainer, .requestRateLimited, .missingEntitlement, .invalidArguments,
1740+
.resultsTruncated, .assetFileNotFound, .assetFileModified, .incompatibleVersion,
1741+
.constraintViolation, .changeTokenExpired, .badDatabase, .quotaExceeded,
1742+
.limitExceeded, .userDeletedZone, .tooManyParticipants, .alreadyShared,
1743+
.managedAccountRestricted, .participantMayNeedVerification, .serverResponseLost,
1744+
.assetNotAvailable, .accountTemporarilyUnavailable, .permissionFailure,
1745+
.unknownItem, .serverRecordChanged, .serverRejectedRequest, .zoneNotFound:
17471746
break
1747+
#if canImport(FoundationModels)
1748+
case .participantAlreadyInvited:
1749+
break
1750+
#endif
17481751
@unknown default:
17491752
break
17501753
}

Sources/SQLiteData/Documentation.docc/Articles/AddingToGRDB.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ to specify that:
183183
}
184184
```
185185

186-
The library further requires your tables use globally unique identifiers (such as UUID) for their
187-
primary keys, and in particular auto-incrementing integer IDs do _not_ work. You will need to
188-
migrate your tables to use UUIDs, see
186+
The library further requires your tables use globally unique identifiers (such as UUID) for their
187+
primary keys, and in particular auto-incrementing integer IDs do _not_ work. You will need to
188+
migrate your tables to use UUIDs, see
189189
<doc:CloudKit#Preparing-an-existing-schema-for-synchronization> for more information.
190190

191191
[GRDB]: http://github.com/groue/GRDB.swift

Sources/SQLiteData/Documentation.docc/Articles/CloudKit.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ CREATE TABLE "reminders"(
237237
) STRICT
238238
```
239239

240-
> Tip: See SQLite's documentation on [foreign keys](https://sqlite.org/foreignkeys.html) for more information.
240+
> Tip: See SQLite's documentation on [foreign keys](https://sqlite.org/foreignkeys.html) for more information.
241241
242242
SQLiteData can synchronize many-to-one and many-to-many relationships to CloudKit,
243243
and you can enforce foreign key constraints in your database connection. While it is possible for
@@ -706,19 +706,19 @@ And in previews you can use it like so:
706706
If you have an existing app deployed to the app store using SQLite, then you may have to perform
707707
a migration on your schema to prepare it for synchronization. The most important requirement
708708
detailed above in <doc:CloudKit#Designing-your-schema-with-synchronization-in-mind> is that
709-
all tables _must_ have a primary key, and all primary keys must be globally unique identifiers
709+
all tables _must_ have a primary key, and all primary keys must be globally unique identifiers
710710
such as UUID, and cannot be simple auto-incrementing integers.
711711
712-
The steps required to perform such a process are quite lengthy (the SQLite docs describe it in
712+
The steps required to perform such a process are quite lengthy (the SQLite docs describe it in
713713
[12 parts]), and those steps are easy to get wrong, which can either result in the migration
714714
failing or your app accidentally corrupting your user's data.
715715
716-
SQLiteData provides a tool called ``SyncEngine/migratePrimaryKeys(_:tables:uuid:)`` that
716+
SQLiteData provides a tool called ``SyncEngine/migratePrimaryKeys(_:tables:uuid:)`` that
717717
makes it possible to perform this migration in just 2 steps:
718718
719719
* Update your Swift data types (then used annotated with `@Table`) to use UUID identifiers instead
720720
of `Int`, and fix all of the resulting compiler errors in your features.
721-
* Create a new migration and invoke ``SyncEngine/migratePrimaryKeys(_:tables:uuid:)`` with the
721+
* Create a new migration and invoke ``SyncEngine/migratePrimaryKeys(_:tables:uuid:)`` with the
722722
database handle from your migration and a list of all of your tables:
723723
724724
```swift
@@ -731,7 +731,7 @@ makes it possible to perform this migration in just 2 steps:
731731
That will perform the many step process of migrating each table from integer-based primary keys
732732
to UUIDs.
733733
734-
This migration tool tries to be conservative with its efforts so that if it ever detects a
734+
This migration tool tries to be conservative with its efforts so that if it ever detects a
735735
schema it does not know how to handle properly, it will throw an error. If this happens, then
736736
you must migrate your tables manually using the introduces in <doc:ManuallyMigratingPrimaryKeys>.
737737

Sources/SQLiteData/Documentation.docc/Articles/ManuallyMigratingPrimaryKeys.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ that all primary keys are UUIDs.
66
## Overview
77

88
If the [manual migration](<doc:SyncEngine/migratePrimaryKeys(_:tables:uuid:)>) tool provided
9-
by this library does not work for you, then you will need to migrate your tables manually.
9+
by this library does not work for you, then you will need to migrate your tables manually.
1010
This consists of converting integer primary keys to UUIDs, and adding a primary key to all tables
1111
that do not have one.
1212

0 commit comments

Comments
 (0)