{"id":"e615a8b3-23df-44bb-91d2-838a727a7a1f","slug":"subsc-taha-cloudkit-skill","name":"cloudkit","description":"Apple CloudKit framework for iOS/macOS/watchOS/tvOS development. Use for iCloud data persistence, multi-device sync, CKSyncEngine implementation, CKContainer/CKDatabase/CKRecord operations, conflict resolution, error handling, subscriptions, and CloudKit best practices. Triggers on CloudKit questions, iCloud sync implementation, CKRecord CRUD, zone management, or cross-device data synchronization in Swift/SwiftUI apps.","canonicalUrl":"https://xpersona.co/skill/subsc-taha-cloudkit-skill","sourceUrl":"https://github.com/subsc-taha/cloudkit-skill","homepage":null,"source":"GITHUB_OPENCLEW","vendor":{"slug":"subsc-taha","label":"Subsc Taha","url":"https://github.com/subsc-taha/cloudkit-skill"},"protocols":["OPENCLEW"],"capabilities":["custom"],"trustScore":null,"trustConfidence":"unknown","artifactCount":0,"benchmarkCount":0,"lastRelease":null,"freshnessAt":"2026-04-15T02:14:19.202Z","freshnessLabel":"Apr 15, 2026","securityReviewed":true,"openapiReady":false,"stats":[{"label":"Trust score","value":"Unknown"},{"label":"Compatibility","value":"OpenClaw"},{"label":"Freshness","value":"Apr 15, 2026"},{"label":"Vendor","value":"Subsc Taha"},{"label":"Artifacts","value":"0"},{"label":"Benchmarks","value":"0"},{"label":"Last release","value":"Unpublished"}],"factsPreview":[{"factKey":"docs_crawl","category":"integration","label":"Crawlable docs","value":"6 indexed pages on the official domain","href":"https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenclaw%2Fskills%2Ftree%2Fmain%2Fskills%2Fasleep123%2Fcaldav-calendar","sourceUrl":"https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fopenclaw%2Fskills%2Ftree%2Fmain%2Fskills%2Fasleep123%2Fcaldav-calendar","sourceType":"search_document","confidence":"medium","observedAt":"2026-04-15T05:03:46.393Z","isPublic":true},{"factKey":"vendor","category":"vendor","label":"Vendor","value":"Subsc Taha","href":"https://github.com/subsc-taha/cloudkit-skill","sourceUrl":"https://github.com/subsc-taha/cloudkit-skill","sourceType":"profile","confidence":"medium","observedAt":"2026-04-15T02:14:19.202Z","isPublic":true},{"factKey":"protocols","category":"compatibility","label":"Protocol compatibility","value":"OpenClaw","href":"https://xpersona.co/api/v1/agents/subsc-taha-cloudkit-skill/contract","sourceUrl":"https://xpersona.co/api/v1/agents/subsc-taha-cloudkit-skill/contract","sourceType":"contract","confidence":"medium","observedAt":"2026-04-15T02:14:19.202Z","isPublic":true},{"factKey":"handshake_status","category":"security","label":"Handshake status","value":"UNKNOWN","href":"https://xpersona.co/api/v1/agents/subsc-taha-cloudkit-skill/trust","sourceUrl":"https://xpersona.co/api/v1/agents/subsc-taha-cloudkit-skill/trust","sourceType":"trust","confidence":"medium","observedAt":null,"isPublic":true}],"highlights":["Trust evidence available"],"agentCard":{"name":"cloudkit","description":"Apple CloudKit framework for iOS/macOS/watchOS/tvOS development. Use for iCloud data persistence, multi-device sync, CKSyncEngine implementation, CKContainer/CKDatabase/CKRecord operations, conflict resolution, error handling, subscriptions, and CloudKit best practices. Triggers on CloudKit questions, iCloud sync implementation, CKRecord CRUD, zone management, or cross-device data synchronization in Swift/SwiftUI apps.","source":"GITHUB_OPENCLEW","sourceId":"github:1152780727","repository":"https://github.com/subsc-taha/cloudkit-skill","documentation":"https://xpersona.co/skill/subsc-taha-cloudkit-skill/agent/subsc-taha-cloudkit-skill","protocols":["OPENCLEW"],"capabilities":["custom"],"languages":["typescript"],"install":{"command":"git clone https://github.com/subsc-taha/cloudkit-skill.git","ecosystem":"git"},"examples":[{"kind":"example","language":"swift","snippet":"import CloudKit\n\n// Initialize container and database\nlet container = CKContainer.default()  // or CKContainer(identifier: \"iCloud.your.bundle.id\")\nlet privateDB = container.privateCloudDatabase\nlet publicDB = container.publicCloudDatabase\nlet sharedDB = container.sharedCloudDatabase"},{"kind":"example","language":"swift","snippet":"import CloudKit\n\nclass SyncManager: CKSyncEngineDelegate {\n    private var engine: CKSyncEngine!\n    private let container = CKContainer(identifier: \"iCloud.your.bundle.id\")\n    \n    init() {\n        let config = CKSyncEngine.Configuration(\n            database: container.privateCloudDatabase,\n            stateSerialization: loadCachedState(),  // nil if first launch\n            delegate: self\n        )\n        engine = CKSyncEngine(config)\n    }\n    \n    // MARK: - Delegate Methods\n    \n    func handleEvent(_ event: CKSyncEngine.Event, syncEngine: CKSyncEngine) async {\n        switch event {\n        case .stateUpdate(let update):\n            // CRITICAL: Always cache the state token\n            saveCachedState(update.stateSerialization)\n            \n        case .accountChange(let change):\n            handleAccountChange(change)\n            \n        case .fetchedRecordZoneChanges(let changes):\n            // Server → Local: Process incoming data\n            for modification in changes.modifications {\n                saveLocally(modification.record)\n            }\n            for deletion in changes.deletions {\n                deleteLocally(deletion.recordID)\n            }\n            \n        case .sentRecordZoneChanges(let sent):\n            // Confirm successful uploads, handle failures\n            for failure in sent.failedRecordSaves {\n                handleSaveFailure(failure)\n            }\n            \n        default: break\n        }\n    }\n    \n    func nextRecordZoneChangeBatch(_ context: CKSyncEngine.SendChangesContext, \n                                    syncEngine: CKSyncEngine) async -> CKSyncEngine.RecordZoneChangeBatch? {\n        // Local → Server: Provide records to upload\n        let pending = syncEngine.state.pendingRecordZoneChanges.filter { \n            context.options.scope.contains($0) \n        }\n        return await CKSyncEngine.RecordZoneChangeBatch(pendingChanges: pending) { recordID in\n            return getLocalRecord(for: recordID)\n      "}]}}