Skip to content
Draft
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
6 changes: 3 additions & 3 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.18.4"),
.package(
url: "https://github.com/pointfreeco/swift-structured-queries",
from: "0.27.0",
branch: "main",
// from: "0.27.0",
traits: [
.trait(name: "StructuredQueriesTagged", condition: .when(traits: ["SQLiteDataTagged"]))
]
Expand Down
10 changes: 9 additions & 1 deletion Sources/SQLiteData/CloudKit/SyncEngine.swift
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,15 @@
/// See <doc:CloudKit#Updating-triggers-to-be-compatible-with-synchronization> for more info.
@DatabaseFunction("sqlitedata_icloud_syncEngineIsSynchronizingChanges")
public static var isSynchronizing: Bool {
_isSynchronizingChanges
if _isCreatingTemporaryTrigger {
reportIssue(
"""
Invoked 'SyncEngine.isSynchronizing' at trigger creation, which is unexpected. Use \
'SyncEngine.$isSynchronizing' to invoke at trigger execution, instead.
"""
)
}
return _isSynchronizingChanges
}

@available(*, deprecated, message: "Use 'SyncEngine.$isSynchronizing', instead.")
Expand Down
2 changes: 1 addition & 1 deletion Tests/SQLiteDataTests/AssertQueryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct AssertQueryTests {
"""
SELECT "records"."id", "records"."date"
FROM "records"
WHERE ("records"."id") = (1)
WHERE (("records"."id") = (1))
"""
} results: {
"""
Expand Down
22 changes: 22 additions & 0 deletions Tests/SQLiteDataTests/CloudKitTests/SyncEngineTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@
"""
)
}

@Test func isSynchronizingTriggerWarning() {
withKnownIssue {
_ = Reminder.createTemporaryTrigger(
after: .insert { new in
Values(SyncEngine.isSynchronizing)
}
)
} matching: { issue in
issue.description.hasSuffix(
"""
Invoked 'SyncEngine.isSynchronizing' at trigger creation, which is unexpected. Use \
'SyncEngine.$isSynchronizing' to invoke at trigger execution, instead.
"""
)
}
_ = Reminder.createTemporaryTrigger(
after: .insert { new in
Values(SyncEngine.$isSynchronizing)
}
)
}
}
}

Expand Down
Loading