Created
May 18, 2020 12:57
-
-
Save atimca/6e45a12034361e55a2743a6da36c6706 to your computer and use it in GitHub Desktop.
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
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