From c34559cc58d365a8a55ae3d2b3fb79a73615c79e Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Mon, 13 Apr 2020 12:39:42 +0800 Subject: [PATCH] Make `Defaults` be an enum instead of a class --- Sources/Defaults/Defaults.swift | 4 +--- Sources/Defaults/Observation.swift | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/Defaults/Defaults.swift b/Sources/Defaults/Defaults.swift index bb0cf88..38ae5f2 100644 --- a/Sources/Defaults/Defaults.swift +++ b/Sources/Defaults/Defaults.swift @@ -1,7 +1,7 @@ // MIT License © Sindre Sorhus import Foundation -public final class Defaults { +public enum Defaults { public class Keys { public typealias Key = Defaults.Key @@ -79,8 +79,6 @@ public final class Defaults { } } - fileprivate init() {} - /// Access a defaults value using a `Defaults.Key`. public static subscript(key: Key) -> Value { get { key.suite[key] } diff --git a/Sources/Defaults/Observation.swift b/Sources/Defaults/Observation.swift index bc3fba4..f01ff5c 100644 --- a/Sources/Defaults/Observation.swift +++ b/Sources/Defaults/Observation.swift @@ -65,7 +65,7 @@ extension Defaults { return try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(dataValue) as? Value } - final class BaseChange { + struct BaseChange { let kind: NSKeyValueChange let indexes: IndexSet? let isPrior: Bool