diff --git a/Sources/Packages/Sources/SecretKit/Documentation.docc/Documentation.md b/Sources/Packages/Sources/SecretKit/Documentation.docc/Documentation.md index c278de7..6888611 100644 --- a/Sources/Packages/Sources/SecretKit/Documentation.docc/Documentation.md +++ b/Sources/Packages/Sources/SecretKit/Documentation.docc/Documentation.md @@ -2,10 +2,6 @@ SecretKit is a collection of protocols describing secrets and stores. -## Overview - -Overview - ## Topics ### Base Protocols diff --git a/Sources/Packages/Sources/SecretKit/SecretStoreList.swift b/Sources/Packages/Sources/SecretKit/SecretStoreList.swift index 0263a76..57fed98 100644 --- a/Sources/Packages/Sources/SecretKit/SecretStoreList.swift +++ b/Sources/Packages/Sources/SecretKit/SecretStoreList.swift @@ -1,25 +1,32 @@ import Foundation import Combine +/// A "Store Store," which holds a list of type-erased stores. public class SecretStoreList: ObservableObject { + /// The Stores managed by the SecretStoreList. @Published public var stores: [AnySecretStore] = [] + /// A modifiable store, if one is available. @Published public var modifiableStore: AnySecretStoreModifiable? private var sinks: [AnyCancellable] = [] + /// Initializes a SecretStoreList. public init() { } + /// Adds a non-type-erased SecretStore to the list. public func add(store: SecretStoreType) { addInternal(store: AnySecretStore(store)) } + /// Adds a non-type-erased modifiable SecretStore. public func add(store: SecretStoreType) { let modifiable = AnySecretStoreModifiable(modifiable: store) modifiableStore = modifiable addInternal(store: modifiable) } + /// A boolean describing whether there are any Stores available. public var anyAvailable: Bool { stores.reduce(false, { $0 || $1.isAvailable }) }