mirror of
https://github.com/Toxblh/MTMR.git
synced 2026-01-11 17:38:38 +00:00
34 lines
1.0 KiB
Swift
34 lines
1.0 KiB
Swift
import Foundation
|
|
|
|
struct AppSettings {
|
|
@UserDefault(key: "com.toxblh.mtmr.settings.showControlStrip", defaultValue: false)
|
|
static var showControlStripState: Bool
|
|
|
|
@UserDefault(key: "com.toxblh.mtmr.settings.hapticFeedback", defaultValue: true)
|
|
static var hapticFeedbackState: Bool
|
|
|
|
@UserDefault(key: "com.toxblh.mtmr.settings.multitouchGestures", defaultValue: true)
|
|
static var multitouchGestures: Bool
|
|
|
|
@UserDefault(key: "com.toxblh.mtmr.blackListedApps", defaultValue: [])
|
|
static var blacklistedAppIds: [String]
|
|
|
|
@UserDefault(key: "com.toxblh.mtmr.dock.persistent", defaultValue: [])
|
|
static var dockPersistentAppIds: [String]
|
|
}
|
|
|
|
@propertyWrapper
|
|
struct UserDefault<T> {
|
|
let key: String
|
|
let defaultValue: T
|
|
var wrappedValue: T {
|
|
get {
|
|
return UserDefaults.standard.object(forKey: key) as? T ?? defaultValue
|
|
}
|
|
set {
|
|
UserDefaults.standard.set(newValue, forKey: key)
|
|
UserDefaults.standard.synchronize()
|
|
}
|
|
}
|
|
}
|