1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-11 07:22:23 +03:00
vimr/VimR/PrefService.swift
2017-03-29 21:36:12 +02:00

28 lines
570 B
Swift

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