Skip to content

Commit

Permalink
Fix access level for init and other tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
LarsJK authored and dezinezync committed Dec 17, 2022
1 parent c6c3b42 commit e37e6d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Sources/Defaults/Defaults.swift
Original file line number Diff line number Diff line change
@@ -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<T: Codable>: 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
}
Expand All @@ -17,7 +19,7 @@ public final class Defaults {
public final class OptionalKey<T: Codable>: Keys {
fileprivate let name: String

init(_ key: String) {
public init(_ key: String) {
self.name = key
}
}
Expand Down
4 changes: 2 additions & 2 deletions Tests/DefaultsTests/DefaultsTests.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import XCTest
@testable import Defaults
import Defaults

let fixtureUrl = URL(string: "httos://sindresorhus.com")!

Expand All @@ -22,7 +22,7 @@ final class DefaultsTests: XCTestCase {
defaults.clear()
}

func testKey() {
func testKey() {
let key = Defaults.Key<Bool>("key", default: false)
XCTAssertFalse(UserDefaults.standard[key])
UserDefaults.standard[key] = true
Expand Down

0 comments on commit e37e6d5

Please sign in to comment.