From c54f98543066e5d0844fbda4b57fac0ea5faa13b Mon Sep 17 00:00:00 2001 From: Daniel Thorpe <309420+danthorpe@users.noreply.github.com> Date: Mon, 22 Apr 2024 08:18:51 +0100 Subject: [PATCH] chore: Tweak inits (#10) Co-authored-by: danthorpe --- Package.swift | 1 - Sources/ComposableLoadable/LoadableState.swift | 6 +++++- Sources/ComposableLoadable/LoadingReducer.swift | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index 49a404e60..b3c848e28 100644 --- a/Package.swift +++ b/Package.swift @@ -16,7 +16,6 @@ package.platforms = [ // MARK: - 🧸 Module Names let ComposableLoadable = "ComposableLoadable" -let Utilities = "Utilities" let BasePath = "." diff --git a/Sources/ComposableLoadable/LoadableState.swift b/Sources/ComposableLoadable/LoadableState.swift index cb9feab4d..4d090a0f7 100644 --- a/Sources/ComposableLoadable/LoadableState.swift +++ b/Sources/ComposableLoadable/LoadableState.swift @@ -74,7 +74,7 @@ public struct LoadableState { } } - public init(request: Request, wrappedValue: Value?) { + public init(wrappedValue: Value?, request: Request) { self.init(request: request, wrappedValue.map { .success($0) }) } @@ -225,6 +225,10 @@ extension LoadableState where Request == EmptyLoadRequest { .init(current: .active, previous: .pending) } + public init(wrappedValue: Value?) { + self.init(wrappedValue: wrappedValue, request: EmptyLoadRequest()) + } + public init(success value: Value) { self.init(request: EmptyLoadRequest(), success: value) } diff --git a/Sources/ComposableLoadable/LoadingReducer.swift b/Sources/ComposableLoadable/LoadingReducer.swift index a9d846a33..8334949e0 100644 --- a/Sources/ComposableLoadable/LoadingReducer.swift +++ b/Sources/ComposableLoadable/LoadingReducer.swift @@ -24,7 +24,7 @@ extension Reducer { ) } - // Integrate a Loadable child domain which does not require a Request type + /// Integrate a Loadable child domain which does not require a Request type public func loadable( _ toLoadableState: WritableKeyPath>, action toLoadingAction: CaseKeyPath<