Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
func mutate(action: Action) -> Observable<Mutation> {
switch action {
case .follow:
return UserService.follow()
.map { Mutation.setFollowing(true) }
case .unfollow:
return UserService.unfollow()
.map { Mutation.setFollowing(false) }
func reduce(state: State, mutation: Mutation) -> State {
var newState = state
switch mutation {
case let setFollowing(isFollowing):
newState.isFollowing = isFollowing
return newState
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment