|
60 | 60 | where Self == AppStorageKey<String> {
|
61 | 61 | AppStorageKey(key, store: store)
|
62 | 62 | }
|
63 |
| - |
| 63 | + |
| 64 | + /// Creates a shared key that can read and write to a string array user default. |
| 65 | + /// |
| 66 | + /// - Parameters: |
| 67 | + /// - key: The key to read and write the value to in the user defaults store. |
| 68 | + /// - store: The user defaults store to read and write to. A value of `nil` will use the user |
| 69 | + /// default store from dependencies. |
| 70 | + /// - Returns: A user defaults shared key. |
| 71 | + public static func appStorage(_ key: String, store: UserDefaults? = nil) -> Self |
| 72 | + where Self == AppStorageKey<[String]> { |
| 73 | + AppStorageKey(key, store: store) |
| 74 | + } |
| 75 | + |
64 | 76 | /// Creates a shared key that can read and write to a URL user default.
|
65 | 77 | ///
|
66 | 78 | /// - Parameters:
|
|
188 | 200 | where Self == AppStorageKey<String?> {
|
189 | 201 | AppStorageKey(key, store: store)
|
190 | 202 | }
|
191 |
| - |
| 203 | + |
| 204 | + /// Creates a shared key that can read and write to an optional string array user default. |
| 205 | + /// |
| 206 | + /// - Parameters: |
| 207 | + /// - key: The key to read and write the value to in the user defaults store. |
| 208 | + /// - store: The user defaults store to read and write to. A value of `nil` will use the user |
| 209 | + /// default store from dependencies. |
| 210 | + /// - Returns: A user defaults shared key. |
| 211 | + public static func appStorage(_ key: String, store: UserDefaults? = nil) -> Self |
| 212 | + where Self == AppStorageKey<[String]?> { |
| 213 | + AppStorageKey(key, store: store) |
| 214 | + } |
| 215 | + |
192 | 216 | /// Creates a shared key that can read and write to an optional URL user default.
|
193 | 217 | ///
|
194 | 218 | /// - Parameters:
|
|
333 | 357 | fileprivate init(_ key: String, store: UserDefaults?) where Value == String {
|
334 | 358 | self.init(lookup: CastableLookup(), key: key, store: store)
|
335 | 359 | }
|
336 |
| - |
| 360 | + |
| 361 | + fileprivate init(_ key: String, store: UserDefaults?) where Value == [String] { |
| 362 | + self.init(lookup: CastableLookup(), key: key, store: store) |
| 363 | + } |
| 364 | + |
337 | 365 | fileprivate init(_ key: String, store: UserDefaults?) where Value == URL {
|
338 | 366 | self.init(lookup: URLLookup(), key: key, store: store)
|
339 | 367 | }
|
|
373 | 401 | fileprivate init(_ key: String, store: UserDefaults?) where Value == String? {
|
374 | 402 | self.init(lookup: OptionalLookup(base: CastableLookup()), key: key, store: store)
|
375 | 403 | }
|
376 |
| - |
| 404 | + |
| 405 | + fileprivate init(_ key: String, store: UserDefaults?) where Value == [String]? { |
| 406 | + self.init(lookup: OptionalLookup(base: CastableLookup()), key: key, store: store) |
| 407 | + } |
| 408 | + |
377 | 409 | fileprivate init(_ key: String, store: UserDefaults?) where Value == URL? {
|
378 | 410 | self.init(lookup: OptionalLookup(base: URLLookup()), key: key, store: store)
|
379 | 411 | }
|
|
0 commit comments