1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-28 08:13:17 +03:00
vimr/VimR/OpenedFileListTransformer.swift
2017-02-26 14:23:23 +01:00

28 lines
602 B
Swift

/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Foundation
import RxSwift
class OpenedFileListTransformer: Transformer {
typealias Pair = StateActionPair<UuidState<MainWindow.State>, OpenedFileList.Action>
func transform(_ source: Observable<Pair>) -> Observable<Pair> {
return source.map { pair in
var state = pair.state.payload
switch pair.action {
case let .open(buffer):
state.currentBuffer = buffer
}
return StateActionPair(state: UuidState(uuid: pair.state.uuid, state: state), action: pair.action)
}
}
}