Self { get } static func reduce(state: Self, action: Action) -> Self } public struct State: StateProtocol { public let networkState: NetworkState public static let initial: State = .init( networkState: .initial ) public static func reduce(state: State, action: Action) -> State { return State( networkState: NetworkState.reduce(state: state.networkState, action: action) ) } } public struct NetworkState: StateProtocol { let isOffline: Bool public static let initial = NetworkState(isOffline: false) public static func reduce(state: NetworkState, action: Action) -> NetworkState { switch action { case is EnterOfflineMode: return .init(isOffline: true) case is SuccessAction: return .init(isOffline: false) default: return state } } }