Created
June 19, 2020 09:12
-
-
Save atimca/7029a319d475e7d34f46e76faa5e741d 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 | |
) -> Reducer { | |
return { appState, appEvent in | |
var appState = appState | |
let newsState = appStateIntoNews(appState) | |
let newNewsState = newsReducer(newsState, appEvent) | |
appState.newsState = newNewsState | |
return appState | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment