1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-01 10:02:36 +03:00
vimr/VimR/AdvancedPrefReducer.swift
2017-03-30 20:05:57 +02:00

30 lines
637 B
Swift

/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Foundation
import RxSwift
class AdvancedPrefReducer: Reducer {
typealias Pair = StateActionPair<AppState, AdvancedPref.Action>
func reduce(_ source: Observable<Pair>) -> Observable<Pair> {
return source.map { pair in
var state = pair.state
switch pair.action {
case let .setUseInteractiveZsh(value):
state.mainWindowTemplate.useInteractiveZsh = value
case let .setUseSnapshotUpdate(value):
state.useSnapshotUpdate = value
}
return StateActionPair(state: state, action: pair.action)
}
}
}