Last active
April 14, 2020 07:58
-
-
Save finestructure/52ab97094b05bf09a726fd6c2576402e to your computer and use it in GitHub Desktop.
"Guidance protocols" for Composable Architecture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CAProtocols.swift | |
// RequirementEditor | |
// | |
// Created by Sven A. Schmidt on 29/03/2020. | |
// Copyright © 2020 finestructure. All rights reserved. | |
// | |
import SwiftUI | |
import ComposableArchitecture | |
public protocol CAInitialStore { | |
associatedtype State | |
associatedtype Action | |
// FIXME: change to .live and .mock | |
static func initialStore() -> Store<State, Action> | |
} | |
public protocol CABasicView: View { | |
associatedtype State | |
associatedtype Action | |
var store: Store<State, Action> { get } | |
// Default: | |
// @ObservedObject public private(set) var store: Store<State, Action> | |
// public init(store: Store<State, Action> = Self.initialStore()) { | |
// self.store = store | |
// } | |
static var reducer: Reducer<State, Action, Void> { get } | |
// Default: | |
// public static let reducer = Reducer<State, Action, Void> { state, action, _ in .noop } | |
} | |
public protocol CABasicEnvView: View { | |
associatedtype State | |
associatedtype Action | |
associatedtype Environment | |
var store: Store<State, Action> { get } | |
// Default: | |
// @ObservedObject public var private(set) store: Store<State, Action> | |
// public init(store: Store<State, Action> = Self.initialStore()) { | |
// self.store = store | |
// } | |
static var reducer: Reducer<State, Action, Environment> { get } | |
// Default: | |
// public static let reducer = Reducer<State, Action, Environment> { state, action, env in .noop } | |
} | |
public protocol CASystemEnvView: View { | |
associatedtype State | |
associatedtype Action | |
associatedtype Environment | |
var store: Store<State, Action> { get } | |
// Default: | |
// @ObservedObject public var private(set) store: Store<State, Action> | |
// public init(store: Store<State, Action> = Self.initialStore()) { | |
// self.store = store | |
// } | |
static var reducer: Reducer<State, Action, SystemEnvironment<Environment>> { get } | |
// Default: | |
// public static let reducer = Reducer<State, Action, SystemEnvironment<Environment>> { state, action, env in .noop } | |
} | |
public protocol CAMock { | |
static var mock: Self { get } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment