Open Taehyeon-Kim opened 9 months ago
import SwiftUI import ComposableArchitecture @Reducer struct SignInFeature { struct State: Equatable { // ... @PresentationState var alert: AlertState<AlertAction>? // ... } enum Action { case alert(PresentationAction<AlertAction>) } enum AlertAction { case confirm } var body: some Reducer<State, Action> { Reduce { state, action in switch action { case .alert: state.alert = nil return .none case let .displayError(error): state.alert = AlertState(title: { TextState(error.localizedDescription) }) return .none } .ifLet(\.$alert, action: /Action.alert) } }
.alert(store: self.store.scope(state: \.$alert, action: { .alert($0) }))
https://github.com/pointfreeco/swift-composable-architecture/discussions/2518 https://pointfreeco.github.io/swift-composable-architecture/0.45.0/documentation/composablearchitecture/alertstate/
Feature
View
Links:
https://github.com/pointfreeco/swift-composable-architecture/discussions/2518 https://pointfreeco.github.io/swift-composable-architecture/0.45.0/documentation/composablearchitecture/alertstate/