From a437dfcfa6582c609fc013b30bace9e5a2b72718 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Mon, 18 May 2026 11:22:26 -0500 Subject: [PATCH] Make animation optional in load endpoints --- Sources/SQLiteData/Fetch.swift | 2 +- Sources/SQLiteData/FetchAll.swift | 4 ++-- Sources/SQLiteData/FetchOne.swift | 12 ++++++------ Sources/SQLiteData/Internal/FetchKey+SwiftUI.swift | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Sources/SQLiteData/Fetch.swift b/Sources/SQLiteData/Fetch.swift index b705dd0f..8327ab1b 100644 --- a/Sources/SQLiteData/Fetch.swift +++ b/Sources/SQLiteData/Fetch.swift @@ -205,7 +205,7 @@ extension Fetch: Equatable where Value: Equatable { public func load( _ request: some FetchKeyRequest, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription { try await sharedReader.load(.fetch(request, database: database, animation: animation)) return FetchSubscription(sharedReader: sharedReader) diff --git a/Sources/SQLiteData/FetchAll.swift b/Sources/SQLiteData/FetchAll.swift index 6e6e885f..ce06ea56 100644 --- a/Sources/SQLiteData/FetchAll.swift +++ b/Sources/SQLiteData/FetchAll.swift @@ -531,7 +531,7 @@ extension FetchAll: Equatable where Element: Equatable { public func load( _ statement: S, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription where Element == S.From.QueryOutput, @@ -557,7 +557,7 @@ extension FetchAll: Equatable where Element: Equatable { public func load( _ statement: some StructuredQueriesCore.Statement, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription where Element == V.QueryOutput, diff --git a/Sources/SQLiteData/FetchOne.swift b/Sources/SQLiteData/FetchOne.swift index 9eb47a1f..7d6b7077 100644 --- a/Sources/SQLiteData/FetchOne.swift +++ b/Sources/SQLiteData/FetchOne.swift @@ -1189,7 +1189,7 @@ extension FetchOne: Equatable where Value: Equatable { public func load( _ statement: S, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription where Value == S.From.QueryOutput, @@ -1213,7 +1213,7 @@ extension FetchOne: Equatable where Value: Equatable { public func load( _ statement: some StructuredQueriesCore.Statement, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription where Value == V.QueryOutput @@ -1235,7 +1235,7 @@ extension FetchOne: Equatable where Value: Equatable { public func load( _ statement: some StructuredQueriesCore.Statement, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription where Value == V.QueryOutput? @@ -1257,7 +1257,7 @@ extension FetchOne: Equatable where Value: Equatable { public func load( _ statement: S, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription where Value: StructuredQueriesCore._OptionalProtocol, @@ -1282,7 +1282,7 @@ extension FetchOne: Equatable where Value: Equatable { public func load( _ statement: S, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription where Value: StructuredQueriesCore._OptionalProtocol, @@ -1307,7 +1307,7 @@ extension FetchOne: Equatable where Value: Equatable { public func load( _ statement: some StructuredQueriesCore.Statement, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) async throws -> FetchSubscription where Value: QueryRepresentable, diff --git a/Sources/SQLiteData/Internal/FetchKey+SwiftUI.swift b/Sources/SQLiteData/Internal/FetchKey+SwiftUI.swift index 078360ae..3e8c4a59 100644 --- a/Sources/SQLiteData/Internal/FetchKey+SwiftUI.swift +++ b/Sources/SQLiteData/Internal/FetchKey+SwiftUI.swift @@ -7,7 +7,7 @@ static func fetch( _ request: some FetchKeyRequest, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) -> Self where Self == FetchKey { .fetch(request, database: database, scheduler: .animation(animation)) @@ -16,7 +16,7 @@ static func fetch( _ request: some FetchKeyRequest, database: (any DatabaseReader)? = nil, - animation: Animation + animation: Animation? ) -> Self where Self == FetchKey.Default { .fetch(request, database: database, scheduler: .animation(animation)) @@ -24,7 +24,7 @@ } package struct AnimatedScheduler: ValueObservationScheduler, Equatable { - let animation: Animation + let animation: Animation? package func immediateInitialValue() -> Bool { true } package func schedule(_ action: @escaping @Sendable () -> Void) { DispatchQueue.main.async { @@ -39,7 +39,7 @@ extension AnimatedScheduler: Hashable {} extension ValueObservationScheduler where Self == AnimatedScheduler { - package static func animation(_ animation: Animation) -> Self { + package static func animation(_ animation: Animation?) -> Self { AnimatedScheduler(animation: animation) } }