API: Aliases

  • A generic representation of a reducer function.

    Reducer functions are pure functions which take a State and Action and return a State.

    let reducer: ReducerFn = { (state: State, action: Action) in
        var state = state
        switch action {
            case let action as SetScores:
                state.home = action.game.home
                state.away = action.game.away
                return state
            default:
                return state
        }
    }
    

    Declaration

    Swift

    public typealias ReducerFn<S> = (S, Action) -> S
  • A generic representation of a selector function.

    Selector functions are pure functions which take a State and return data derived from that State.

    let selectPost = { (state: AppState) in
        return state.singlePost.post
    }
    

    Declaration

    Swift

    public typealias SelectorFn<S, V> = (S) -> V