Structure
KeychainStorage
public struct KeychainStorage<Item: Storable>
A struct defining a Storage caching Items safely inside the user's Keychain.
Relationships
Nested Types
KeychainStorage.IteratorA
structdefining aKeychainStorageiterator.
Conforms To
SequenceStorage
Initializers
init(service:group:accessibility:isSynchronizable:)
public init(
service: String? = nil,
group: String? = nil,
accessibility: Accessibility = .whenUnlocked,
isSynchronizable: Bool = false
)
Init.
Parameters
| Name | Type | Description |
|---|---|---|
| service | String? |
An optional |
| group | String? |
An optional |
| accessibility | Accessibility |
A valid |
| isSynchronizable | Bool |
A |
init(service:group:accessibility:authentication:isSynchronizable:)
public init(
service: String? = nil,
group: String? = nil,
accessibility: Accessibility = .whenUnlocked,
authentication: AuthenticationPolicy = [],
isSynchronizable: Bool = false
)
Init.
Parameters
| Name | Type | Description |
|---|---|---|
| service | String? |
An optional |
| group | String? |
An optional |
| accessibility | Accessibility |
A valid |
| authentication | AuthenticationPolicy |
A valid |
| isSynchronizable | Bool |
A |
Methods
makeIterator()
public func makeIterator() -> Iterator
Compose the iterator.
Returns
Some IteratorProtocol.
insert(_:)
@discardableResult
public func insert(_ item: Item) throws -> (inserted: Bool, memberAfterInsert: Item)
Insert a new item.
Parameters
| Name | Type | Description |
|---|---|---|
| item | Item |
Some |
Returns
A tuple indicating whether a previous value existed, and what this value was.
removeValue(forKey:)
@discardableResult
public func removeValue(forKey key: Item.ID) throws -> Item?
Remove the associated item, if it exists.
Parameters
| Name | Type | Description |
|---|---|---|
| key | Item.ID |
Some |
Throws
Any Error.
Returns
The removed Item, if it exists.