1
0
mirror of https://github.com/metabolist/metatext synced 2025-01-24 00:12:43 +01:00
metatext-app-ios-iphone-ipad/Shared/Model/Defaults.swift
2020-08-05 23:45:57 -07:00

25 lines
539 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
class Defaults {
private let userDefaults: UserDefaults
init(userDefaults: UserDefaults) {
self.userDefaults = userDefaults
}
}
extension Defaults {
enum Item: String {
case recentIdentityID = "recent-identity-id"
}
}
extension Defaults {
subscript<T>(index: Defaults.Item) -> T? {
get { userDefaults.value(forKey: index.rawValue) as? T }
set { userDefaults.set(newValue, forKey: index.rawValue) }
}
}