Make `Defaults` be an enum instead of a class

This commit is contained in:
Sindre Sorhus 2020-04-13 12:39:42 +08:00
parent 31b56ce018
commit c34559cc58
2 changed files with 2 additions and 4 deletions

View File

@ -1,7 +1,7 @@
// MIT License © Sindre Sorhus // MIT License © Sindre Sorhus
import Foundation import Foundation
public final class Defaults { public enum Defaults {
public class Keys { public class Keys {
public typealias Key = Defaults.Key public typealias Key = Defaults.Key
@ -79,8 +79,6 @@ public final class Defaults {
} }
} }
fileprivate init() {}
/// Access a defaults value using a `Defaults.Key`. /// Access a defaults value using a `Defaults.Key`.
public static subscript<Value: Codable>(key: Key<Value>) -> Value { public static subscript<Value: Codable>(key: Key<Value>) -> Value {
get { key.suite[key] } get { key.suite[key] }

View File

@ -65,7 +65,7 @@ extension Defaults {
return try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(dataValue) as? Value return try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(dataValue) as? Value
} }
final class BaseChange { struct BaseChange {
let kind: NSKeyValueChange let kind: NSKeyValueChange
let indexes: IndexSet? let indexes: IndexSet?
let isPrior: Bool let isPrior: Bool