1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-01 10:02:36 +03:00
vimr/VimR/PrefService.swift
2017-02-28 18:53:49 +01:00

27 lines
557 B
Swift

/**
* Tae Won Ha - http://taewon.de - @hataewon
* See LICENSE
*/
import Foundation
import Swifter
import RxSwift
fileprivate let compatibleVersion = "200" // yet dummy
fileprivate let lastCompatibleVersion = "128"
fileprivate let defaults = UserDefaults.standard
class PrefService: Service {
typealias Element = StateActionPair<AppState, UuidAction<MainWindow.Action>>
func apply(_ pair: Element) {
guard case .close = pair.action.payload else {
return
}
defaults.setValue(pair.state.dict(), forKey: compatibleVersion)
}
}