Created
June 19, 2020 09:14
-
-
Save atimca/ff1e6f33f30b46c1a873fa342093f560 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
func transform( | |
newsReducer: @escaping (NewsState, AppEvent) -> NewsState, | |
appStateIntoNews: @escaping (AppState) -> NewsState, | |
mutateAppStateWithNewsState: @escaping (AppState, NewsState) -> AppState | |
) -> Reducer { | |
return { appState, appEvent in | |
let newsState = appStateIntoNews(appState) | |
let newNewsState = newsReducer(newsState, appEvent) | |
return mutateAppStateWithNewsState(appState, newNewsState) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment