UserDefaultsStorage
@StorageActor
open class UserDefaultsStorage : Storage
UserDefaultsStorage subclass of UserDefaults that uses a DelegatedStorage.
-
UserDefaultsStorageshared instance.Declaration
Swift
@StorageActor open class var standard: UserDefaultsStorage { get } -
Create a
UserDefaultsStorage.Declaration
Swift
@StorageActor public convenience init(authenticationTag: Data? = nil)Parameters
authenticationTagCustom additional
Datato be authenticated. -
Create a
UserDefaultsStorage.Declaration
Swift
@StorageActor public init?(suiteName suitename: String?, symmetricKey: SymmetricKey, authenticationTag: Data? = nil)Parameters
suiteNameThe domain identifier of the search list.
symmetricKeyA cryptographic key used to seal the message.
authenticationTagCustom additional
Datato be authenticated. -
Returns the
StorageDataassociated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func data<D>(forKey key: StoreKey) -> D? where D : StorageDataParameters
keyA
StoreKeyin storage. -
Sets the value of the specified
StoreKeyto the specifiedStorageData.Declaration
Swift
@StorageActor open func set(_ data: (some StorageData)?, forKey defaultName: StoreKey)Parameters
dataStorageDatato store.defaultNameThe
StoreKeywith which to associate the value. -
Removes the value of the specified
StoreKey.Declaration
Swift
@StorageActor open func remove(forKey key: StoreKey)Parameters
keyThe
StoreKeywhose value you want to remove. -
Adds the contents of the specified dictionary to the registration domain.
Declaration
Swift
@StorageActor open func register(defaults registrationDictionary: [StoreKey : Any])Parameters
defaultsThe dictionary of keys and values you want to register.
-
Returns the generic value associated with the specified
StoreKey.Declaration
Swift
@StorageActor open func value<V>(forKey key: StoreKey) -> V?Parameters
keyA
StoreKeyin storage. -
Returns the
Decodableassociated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func decodable<D>(forKey key: StoreKey) -> D? where D : DecodableParameters
keyA
StoreKeyin storage. -
Sets the value of the specified
StoreKeyto the specifiedString.Declaration
Swift
@StorageActor open func set(_ string: String, forKey key: StoreKey)Parameters
stringStringto store.keyThe
StoreKeywith which to associate the value. -
Sets the value of the specified
StoreKeyto the specified generic value.Declaration
Swift
@StorageActor open func set(_ value: (some Any)?, forKey key: StoreKey)Parameters
valueGeneric value to store.
keyThe
StoreKeywith which to associate the value. -
Sets the value of the specified
StoreKeyto the specifiedEncodable.Declaration
Swift
@StorageActor open func set(encodable: Encodable?, forKey key: StoreKey)Parameters
encodableEncodableto store.keyThe
StoreKeywith which to associate the value. -
Returns the
Stringassociated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func string(forKey defaultName: StoreKey) -> String?Parameters
defaultNameA
StoreKeyin storage. -
Returns the
[Any]associated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func array(forKey defaultName: StoreKey) -> [Any]?Parameters
defaultNameA
StoreKeyin storage. -
Returns the
Set<AnyHashable>associated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func set(forKey defaultName: StoreKey) -> Set<AnyHashable>?Parameters
defaultNameA
StoreKeyin storage. -
Returns the
[String: Any]associated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func dictionary(forKey defaultName: StoreKey) -> [String : Any]?Parameters
defaultNameA
StoreKeyin storage. -
Returns the
[String]associated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func stringArray(forKey defaultName: StoreKey) -> [String]?Parameters
defaultNameA
StoreKeyin storage. -
Returns the
Intassociated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func integer(forKey defaultName: StoreKey) -> IntParameters
defaultNameA
StoreKeyin storage. -
Returns the
Floatassociated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func float(forKey defaultName: StoreKey) -> FloatParameters
defaultNameA
StoreKeyin storage. -
Returns the
Doubleassociated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func double(forKey defaultName: StoreKey) -> DoubleParameters
defaultNameA
StoreKeyin storage. -
Returns the
Boolassociated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func bool(forKey defaultName: StoreKey) -> BoolParameters
defaultNameA
StoreKeyin storage. -
Returns the
URLassociated with the specifiedStoreKey.Declaration
Swift
@StorageActor open func url(forKey defaultName: StoreKey) -> URL?Parameters
defaultNameA
StoreKeyin storage. -
Sets the value of the specified
StoreKeyto the specifiedInt.Declaration
Swift
@StorageActor open func set(_ value: Int, forKey defaultName: StoreKey)Parameters
valueIntto store.defaultNameThe
StoreKeywith which to associate the value. -
Sets the value of the specified
StoreKeyto the specifiedFloat.Declaration
Swift
@StorageActor open func set(_ value: Float, forKey defaultName: StoreKey)Parameters
valueFloatto store.defaultNameThe
StoreKeywith which to associate the value. -
Sets the value of the specified
StoreKeyto the specifiedDouble.Declaration
Swift
@StorageActor open func set(_ value: Double, forKey defaultName: StoreKey)Parameters
valueDoubleto store.defaultNameThe
StoreKeywith which to associate the value. -
Sets the value of the specified
StoreKeyto the specifiedBool.Declaration
Swift
@StorageActor open func set(_ value: Bool, forKey defaultName: StoreKey)Parameters
valueBoolto store.defaultNameThe
StoreKeywith which to associate the value. -
Sets the value of the specified
StoreKeyto the specifiedURL.Declaration
Swift
@StorageActor open func set(_ url: URL?, forKey defaultName: StoreKey)Parameters
urlURLto store.defaultNameThe
StoreKeywith which to associate the value.
View on GitHub
Install in Dash