diff --git a/Sources/Defaults/Defaults.swift b/Sources/Defaults/Defaults.swift index 0d8807a..8090830 100644 --- a/Sources/Defaults/Defaults.swift +++ b/Sources/Defaults/Defaults.swift @@ -1,14 +1,16 @@ // MIT License © Sindre Sorhus -import Cocoa +import Foundation public final class Defaults { - public class Keys {} + public class Keys { + fileprivate init() {} + } public final class Key: Keys { fileprivate let name: String fileprivate let defaultValue: T - init(_ key: String, default defaultValue: T) { + public init(_ key: String, default defaultValue: T) { self.name = key self.defaultValue = defaultValue } @@ -17,7 +19,7 @@ public final class Defaults { public final class OptionalKey: Keys { fileprivate let name: String - init(_ key: String) { + public init(_ key: String) { self.name = key } } diff --git a/Tests/DefaultsTests/DefaultsTests.swift b/Tests/DefaultsTests/DefaultsTests.swift index 78fff7e..3517811 100644 --- a/Tests/DefaultsTests/DefaultsTests.swift +++ b/Tests/DefaultsTests/DefaultsTests.swift @@ -1,5 +1,5 @@ import XCTest -@testable import Defaults +import Defaults let fixtureUrl = URL(string: "httos://sindresorhus.com")! @@ -22,7 +22,7 @@ final class DefaultsTests: XCTestCase { defaults.clear() } - func testKey() { + func testKey() { let key = Defaults.Key("key", default: false) XCTAssertFalse(UserDefaults.standard[key]) UserDefaults.standard[key] = true