Skip to main content

KeyValueStore

Interface for persisting and loading values.

@objc public protocol KeyValueStore 

Requirements#

object(forKey:​)#

Returns the object associated with the specified key.

func object(forKey defaultName: String) -> Any?

Parameters#

  • defaultName: A key in the current store.

bool(forKey:​)#

Returns the Boolean value associated with the specified key.

func bool(forKey defaultName: String) -> Bool

Parameters#

  • defaultName: A key in the current store.

set(value:​forKey:​)#

Sets the value of the specified key.

func set(value: Any?, forKey defaultName: String)

Parameters#

  • value: The object to store in the store.
  • defaultName: The key with which to associate the value.

set(boolValue:​forKey:​)#

Sets the value of the specified key to the specified Boolean value.

func set(boolValue: Bool, forKey defaultName: String)

Parameters#

  • boolValue: The Boolean value to store.
  • defaultName: The key with which to associate the value.

removeObject(forKey:​)#

Removes the value of the specified default key.

func removeObject(forKey defaultName: String)

Parameters#

  • defaultName: The key whose value you want to remove.