Plugin for using Apple CloudKit Key-Value API in your Capacitor Apps.
npm install capacitor-cloudkit-api
npx cap syncAdd capability in Signing & Capabilities in Xcode project settings called iCloud:

Next, enable Key-value storage and CloudKit settings, and create any container by clicking on + button:

import {CapacitorCloudkitAPI} from 'capacitor-cloudkit-api';
const saveData = async (key: string, value: string): Promise<{
key: string;
value: string;
}> => {
const result = await CapacitorCloudkitAPI.saveKeyValue({
key,
value,
});
return result
}
const getData = async (key: string): Promise<{
key: string;
value: string;
}> => {
const result = await CapacitorCloudkitAPI.getKeyValue({
key
});
return result
}saveKeyValue(options: { key: string; value: string; }) => Promise<{ key: string; value: string; }>| Param | Type |
|---|---|
options |
{ key: string; value: string; } |
Returns: Promise<{ key: string; value: string; }>
getKeyValue(options: { key: string; }) => Promise<{ key: string; value: string; }>| Param | Type |
|---|---|
options |
{ key: string; } |
Returns: Promise<{ key: string; value: string; }>