From 00cef7bf466b972d3b02b52bdc35b8ec39eb414d Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Wed, 8 Jul 2026 13:57:56 -0700 Subject: [PATCH 1/2] Add `LazyInitializableByDefault` trait Makes it easier to turn on the StructuredQueries trait without an explicit dependency. --- Examples/CaseStudies/DynamicQuery.swift | 2 +- Examples/Examples.xcodeproj/project.pbxproj | 4 +++- Examples/Reminders/Schema.swift | 1 + Examples/SyncUps/Dependencies/SpeechClient.swift | 2 +- Examples/SyncUps/SyncUpDetail.swift | 2 +- Package.swift | 8 ++++++++ 6 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Examples/CaseStudies/DynamicQuery.swift b/Examples/CaseStudies/DynamicQuery.swift index 9d388edd..b4c25163 100644 --- a/Examples/CaseStudies/DynamicQuery.swift +++ b/Examples/CaseStudies/DynamicQuery.swift @@ -89,7 +89,7 @@ struct DynamicQueryDemo: SwiftUICaseStudy { func fetch(_ db: Database) throws -> Value { let search = Fact - .where { $0.body.contains(query) } + .where { $0.body.like("%\(query)%") } .order { $0.id.desc() } return try Value( facts: search.fetchAll(db), diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index d21c4881..4d22126d 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 77; + objectVersion = 100; objects = { /* Begin PBXBuildFile section */ @@ -1100,6 +1100,8 @@ isa = XCLocalSwiftPackageReference; relativePath = ..; traits = ( + LazyInitializableByDefault, + StrictDecoding, ); }; /* End XCLocalSwiftPackageReference section */ diff --git a/Examples/Reminders/Schema.swift b/Examples/Reminders/Schema.swift index 50c7746f..54dc8f4f 100644 --- a/Examples/Reminders/Schema.swift +++ b/Examples/Reminders/Schema.swift @@ -36,6 +36,7 @@ nonisolated struct Reminder: Hashable, Identifiable { var notes = "" var position = 0 var priority: Priority? + @Column(lazyInitializable: false) var remindersListID: RemindersList.ID var status: Status = .incomplete var title = "" diff --git a/Examples/SyncUps/Dependencies/SpeechClient.swift b/Examples/SyncUps/Dependencies/SpeechClient.swift index f6725781..66debf07 100644 --- a/Examples/SyncUps/Dependencies/SpeechClient.swift +++ b/Examples/SyncUps/Dependencies/SpeechClient.swift @@ -37,7 +37,7 @@ nonisolated struct SpeechClient: DependencyKey { requestAuthorization: { .authorized }, startTask: { AsyncThrowingStream { continuation in - Task { @MainActor in + _ = Task { @MainActor in isRecording.setValue(true) var finalText = """ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor \ diff --git a/Examples/SyncUps/SyncUpDetail.swift b/Examples/SyncUps/SyncUpDetail.swift index e5b305c1..9818ff3e 100644 --- a/Examples/SyncUps/SyncUpDetail.swift +++ b/Examples/SyncUps/SyncUpDetail.swift @@ -44,7 +44,7 @@ final class SyncUpDetailModel: HashableObject { withErrorReporting { try database.write { db in let ids = indices.map { meetings[$0].id } - try Meeting.where { ids.contains($0.id) }.delete().execute(db) + try Meeting.where { $0.id.in(ids) }.delete().execute(db) } } } diff --git a/Package.swift b/Package.swift index b0834f03..a6595638 100644 --- a/Package.swift +++ b/Package.swift @@ -22,6 +22,10 @@ let package = Package( ), ], traits: [ + .trait( + name: "LazyInitializableByDefault", + description: "Optionalize draft properties that have no default." + ), .trait( name: "StrictDecoding", description: """ @@ -57,6 +61,10 @@ let package = Package( branch: "strict-decoding", // from: "0.32.0", traits: [ + .trait( + name: "LazyInitializableByDefault", + condition: .when(traits: ["LazyInitializableByDefault"]) + ), .trait(name: "CasePaths", condition: .when(traits: ["CasePaths"])), .trait(name: "Tagged", condition: .when(traits: ["Tagged"])), ] From 09893f6a44afc144a818b9f252ce0f1a6be1ca20 Mon Sep 17 00:00:00 2001 From: Stephen Celis Date: Wed, 8 Jul 2026 14:57:09 -0700 Subject: [PATCH 2/2] wip --- Examples/Examples.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Examples/Examples.xcodeproj/project.pbxproj b/Examples/Examples.xcodeproj/project.pbxproj index 4d22126d..29b9f984 100644 --- a/Examples/Examples.xcodeproj/project.pbxproj +++ b/Examples/Examples.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 100; + objectVersion = 77; objects = { /* Begin PBXBuildFile section */