Skip to content

Latest commit

 

History

History
88 lines (61 loc) · 2.14 KB

README.md

File metadata and controls

88 lines (61 loc) · 2.14 KB

capacitor-cloudkit-api

Plugin for using Apple CloudKit Key-Value API in your Capacitor Apps.

Install

npm install capacitor-cloudkit-api
npx cap sync

Preparation

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; }>