Back to Browse

SwiftData + CloudKit Sync (2025): Full Setup Guide for Multi-Device iOS Apps

3.2K views
Oct 6, 2025
20:58

Want to sync your SwiftData models across all your Apple devices? In this step-by-step tutorial, I’ll walk you through setting up SwiftData with CloudKit in Xcode - from creating your model, enabling iCloud, and configuring your container, to testing sync on real devices. 🤔 We’ll cover: ✅ How to enable CloudKit in Xcode and configure your container ✅ The rules for SwiftData models that must be followed (defaults, no unique constraints) ✅ Testing sync across multiple devices (iPhone, iPad) ✅ Debugging tips and common error messages (Error 134060, container mismatch, schema issues) ✅ Using the CloudKit Dashboard to verify your data By the end, you’ll have a working SwiftData + CloudKit integration syncing seamlessly across devices. 🖼 Try It Yourself! Clone or download the full demo project here: 📁 Demo Template: https://github.com/NDCSwift/CloudKitDemo Add logging arguments under “Arguments Passed On Launch” In that same Scheme editor tab (“Run” → “Arguments”): -com.apple.CoreData.CloudKitDebug 1 🔗 Helpful Links: Apple Developer: https://developer.apple.com/icloud/cloudkit/ Apple Developer: https://developer.apple.com/documentation/swiftdata CloudKit Dashboard: https://icloud.developer.apple.com/dashboard/ ⏱️Timestamps 00:00 - Intro & What is CloudKit 00:49 - Creating a Swift Data Model 01:59 - Creating a sample ContentView for input & Saving 03:40 - Updating UUID to support iCloud 04:22 - Query and List of entries 05:07 - Adding Model Container at app launch 05:53 - Enable iCloud in Xcode 06:21 - Creating iCloud Container 07:15 - Better logging 07:44 - First test 08:00 - Fixing our Model with defaults 08:55 - Adding Remote Notifications 09:22 - Second Test 09:48 - Testing on a physical device 10:23 - CloudKit Console 11:21 - Fixing "Field 'recordName' is not marked queryable" error 12:19 - Adding more entries 14:18 - Testing on two devices simultaneously 15:46 - Debugging errors 15:58 - Invalid Bundle ID 16:15 - Bad Container 16:29 - Schema mismatch 16:48 - Permission Failure / not authenticated 17:01 - Records are not syncing 17:27 - Zone / Record not found 17:37 - Unique Attributes crash 18:16 - Development vs Production environment 19:33 - When to flip it over 20:04 - Checklist for CloudKit & Wrap up

Download

1 formats

Video Formats

360pmp428.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

SwiftData + CloudKit Sync (2025): Full Setup Guide for Multi-Device iOS Apps | NatokHD