Created
July 8, 2020 16:22
-
-
Save atimca/15e97150f720340fc09e4a919fbf8249 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
extension State { | |
static func reduce(state: State, event: Event) -> State { | |
var state = state | |
switch event { | |
case .dataLoaded(let data): | |
state = .loaded(data: data) | |
case .loadData: | |
state = .loading | |
} | |
return state | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment