cloudkit

Sync data across devices with CloudKit containers and records.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/onymchat/onym-ios --skill cloudkit-onymchat
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudkit
Source: https://github.com/onymchat/onym-ios/tree/main/.claude/skills/cloudkit
Command: npx skills add https://github.com/onymchat/onym-ios --skill cloudkit-onymchat

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

CloudKit enables cross-device data synchronization for iOS/macOS apps by connecting local data to iCloud databases.

Core Features & Use Cases

  • Container and database setup for Public, Private, and Shared data
  • CKRecord CRUD, CKQuery, and CKSubscription for live updates
  • CKSyncEngine for end-to-end sync on iOS 17+
  • CloudKit + SwiftData integration, NSUbiquitousKeyValueStore, and iCloud Drive file coordination
  • Account status checks and robust error handling for CKError codes
  • Conflict resolution with three-way merging and token management Real-world example: keep user notes in sync across devices with offline support.

Quick Start

Enable iCloud + CloudKit in Signing & Capabilities, configure a container, and begin a basic sync flow.

Frequently Asked Questions about cloudkit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync data across devices with CloudKit in Swift?

To sync data across devices with CloudKit, set up a container in Signing & Capabilities, configure private or shared databases, and use CKRecord CRUD with incremental sync patterns to keep app data updated across iOS and macOS.

What's the best way to handle CloudKit errors like CKError codes?

The best way to handle CloudKit errors involves implementing robust conflict resolution with three-way merging and token management. This ensures your sync flow recovers gracefully from network failures or record conflicts during iCloud database updates.

Does CloudKit work with SwiftData for offline sync?

Yes, CloudKit integrates directly with SwiftData for offline sync. This combination enables local data persistence while automatically syncing changes to iCloud databases, keeping user records consistent across devices even when network connectivity is intermittent.

Can I use CKSyncEngine for end-to-end iCloud sync on iOS 17?

Yes, CKSyncEngine supports end-to-end iCloud sync on iOS 17 and later. It handles the incremental sync flow, automatically managing record changes, conflict resolution, and server token updates to keep your app data current.

When do I need CKSubscription for live CloudKit updates?

You need CKSubscription for live CloudKit updates when your app must react instantly to remote database changes. It pushes notifications to devices whenever records match query criteria, enabling real-time data sync across user devices.