init(_:state:action:then:)
Initializes an IfLetStore
view that computes content depending on if a store of PresentationState
and PresentationAction
is nil
or non-nil
and state can further be extracted from the destination state, e.g. it matches a particular case of an enum.
This declaration is deprecated: Further scope the store into the 'state' and 'action' cases, instead. For more information, see the following article: https://pointfreeco.github.io/swift-composable-architecture/main/documentation/composablearchitecture/migratingto1.5#Enum-driven-navigation-APIs
@preconcurrency @MainActor init<DestinationState, DestinationAction, IfContent>(_ store: Store<PresentationState<DestinationState>, PresentationAction<DestinationAction>>, state toState: @escaping (_ destinationState: DestinationState) -> State?, action fromAction: @escaping (_ action: Action) -> DestinationAction, @ViewBuilder then ifContent: @escaping (_ store: Store<State, Action>) -> IfContent) where Content == IfContent?, IfContent : View
Parameters
- store
A store of optional state.
- toState
A closure that attempts to extract state for the “if” branch from the destination state.
- fromAction
A closure that embeds actions for the “if” branch in destination actions.
- ifContent
A function that is given a store of non-optional state and returns a view that is visible only when the optional state is non-
nil
and state can be extracted from the destination state.