Stores

ReduxKit stores are constructed with a createStore function that returns the Store.

The store creation functions can be easily replaced if needed or wrapped with a StoreEnhancer.

Using a completely generic store creator allows construction out of any object in swift.

  • StoreType protocol

    Parameters: - dispatch: Dispatch = Action -> Action - subscribe: Subscriber = (() -> State) -> ReduxDisposable - getState: () -> State

    See more

    Declaration

    Swift

    public protocol StoreType
  • Store implementation

    Strongly typed alias examples: - typealias AppState = Any - typealias Subscriber = AppState -> () - typealias Store = Store<AppState>

    Parameters: - dispatch: Dispatch = Action -> Action - subscribe: Subscriber = (() -> State) -> ReduxDisposable - getState: () -> State - state: State

    See more

    Declaration

    Swift

    public struct Store<State>: StoreType
  • Creates a ReduxKit Store of a generic State type

    Strongly typed signature

    typealias Reducer = (State?, Action) -> State
    func createStore(reducer: Reducer, state: State?) -> Store
    

    Declaration

    Swift

    public func createStore<State>(reducer: (State?, Action) -> State, state: State?) -> Store<State>

    Parameters

    reducer

    (State?, Action) -> State

    state

    State

    Return Value

    Store