Skip to main content
Version: 0.12

Key-value Storage(iOS)

info

You can check out the official doc for detailed instructions.

API

kvSync

From official doc: This method will call synchronize() to explicitly synchronizes in-memory keys and values with those stored on disk. The only recommended time to call this method is upon app launch, or upon returning to the foreground, to ensure that the in-memory key-value store representation is up-to-date.

function kvSync(): Promise<void>

kvSetItem

function kvSetItem(
key: string,
value: string
): Promise<void>

kvGetItem

function kvGetItem(
key: string,
): Promise<string | undefined>

kvRemoveItem

function kvRemoveItem(
key: string,
): Promise<void>

kvGetAllItems

function kvGetAllItems(): Promise<Record<string, string>>

Event Registers

registerKVStoreRemoteChangedEvent

Call this function at the beginning once to make onKVStoreRemoteChanged work

Events

onKVStoreRemoteChanged

From official doc: This notification is sent only upon a change received from iCloud; it is not sent when your app sets a value.