Skip to content

Instantly share code, notes, and snippets.

@atimca
Created May 18, 2020 12:57
Show Gist options
  • Save atimca/6e45a12034361e55a2743a6da36c6706 to your computer and use it in GitHub Desktop.
Save atimca/6e45a12034361e55a2743a6da36c6706 to your computer and use it in GitHub Desktop.
class Store {
func accept(event: Event) {
state = reduce(state: state, event: event)
}
func reduce(state: State, event: Event) -> State {
var state = state
switch event {
case .changeValue(let newValue):
state.value = newValue
}
return state
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment