Created
June 19, 2020 09:20
-
-
Save atimca/12f6caafd770ea5c8f7443067ed0fca3 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
class NewsStore { | |
@Published private(set) var state: NewsState | |
private let reducer: (NewsState, NewsEvent) -> NewsState | |
init( | |
initialState: NewsState, | |
reducer: @escaping (NewsState, NewsEvent) -> NewsState | |
) { | |
self.state = initialState | |
self.reducer = reducer | |
} | |
func accept(event: NewsEvent) { | |
state = reducer(state, event) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment