1.0.0 • Published 2 years ago
capacitor-cloudkit-api v1.0.0
capacitor-cloudkit-api
Plugin for using Apple CloudKit Key-Value API in your Capacitor Apps.
Install
npm install capacitor-cloudkit-api
npx cap syncPreparation
Add 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:

Usage
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
}API
saveKeyValue(...)
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(...)
getKeyValue(options: { key: string; }) => Promise<{ key: string; value: string; }>| Param | Type |
|---|---|
options | { key: string; } |
Returns: Promise<{ key: string; value: string; }>
1.0.0
2 years ago