parent
be7e30ba36
commit
dd44190ddf
|
@ -46,7 +46,9 @@ public enum Defaults {
|
|||
/**
|
||||
Create a defaults key.
|
||||
|
||||
The `default` parameter can be left out if the `Value` type is an optional.
|
||||
- Parameter key: The key must be ASCII, not start with `@`, and cannot contain a dot (`.`).
|
||||
|
||||
The `default` parameter should not be used if the `Value` type is an optional.
|
||||
*/
|
||||
public init(_ key: String, default defaultValue: Value, suite: UserDefaults = .standard) {
|
||||
self.defaultValue = defaultValue
|
||||
|
@ -86,6 +88,11 @@ extension Defaults {
|
|||
}
|
||||
|
||||
extension Defaults.Key {
|
||||
/**
|
||||
Create a defaults key.
|
||||
|
||||
- Parameter key: The key must be ASCII, not start with `@`, and cannot contain a dot (`.`).
|
||||
*/
|
||||
public convenience init<T>(_ key: String, suite: UserDefaults = .standard) where Value == T? {
|
||||
self.init(key, default: nil, suite: suite)
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ If a type conforms to both `NSSecureCoding` and `Codable`, then `Codable` will b
|
|||
|
||||
You declare the defaults keys upfront with type and default value.
|
||||
|
||||
**Do not use a dot in the key name, because of [this bug](https://github.com/sindresorhus/Defaults/issues/59).**
|
||||
**The key name must be ASCII, not start with `@`, and cannot contain a dot (`.`).**
|
||||
|
||||
```swift
|
||||
import Cocoa
|
||||
|
|
Loading…
Reference in New Issue