RORK LABJP
MAX — Rork Max generates native Swift for iPhone, iPad, Apple Watch, Apple TV, and Vision Pro, with 2-click App Store publishing and no Xcode requiredSTACK — Standard Rork builds cross-platform mobile apps with React Native (Expo); choosing between the two by use case is the key decisionFOCUS — Unlike web-first tools such as Bolt or Lovable, Rork specializes in native iOS and Android app generationBUGS — A hands-on review reports Rork resolved about 70% of bugs without manual help, with the remaining 30% needing edits in the exported codebaseFUNDING — Rork raised $2.8M from a16z (Andreessen Horowitz)PRICING — It is free to start, with paid plans from $25/month, so you can try before committingMAX — Rork Max generates native Swift for iPhone, iPad, Apple Watch, Apple TV, and Vision Pro, with 2-click App Store publishing and no Xcode requiredSTACK — Standard Rork builds cross-platform mobile apps with React Native (Expo); choosing between the two by use case is the key decisionFOCUS — Unlike web-first tools such as Bolt or Lovable, Rork specializes in native iOS and Android app generationBUGS — A hands-on review reports Rork resolved about 70% of bugs without manual help, with the remaining 30% needing edits in the exported codebaseFUNDING — Rork raised $2.8M from a16z (Andreessen Horowitz)PRICING — It is free to start, with paid plans from $25/month, so you can try before committing
Articles/Dev Tools
Dev Tools/2026-06-16Advanced

Designing CloudKit Sync in a Rork Max Native App — Handling Conflicts and Deletes

You want the same data on iPhone and iPad. When you add CloudKit to a Swift app generated by Rork Max, the hard part is not saving — it is conflicts and deletes. Here are the design decisions I settled on.

Rork Max166CloudKitSwift25Sync2Architecture10

Premium Article

Sync Is Not Done When It "Saves"

You add a favorite on iPhone, but it is missing on iPad. Or something you deleted on iPad comes back to the iPhone a while later. When I added sync to a native Swift app generated by Rork Max, this kind of inconsistency was the first thing I hit.

The code to save a record to CloudKit is straightforward. The hard part is the design: conflicts when several devices write at once, and how to propagate a delete to every device. Ship with that left vague and, to the user, it looks like "an app where data spontaneously appears and disappears." From my experience as an indie developer running apps over a long stretch, what erodes trust is not crashes so much as this kind of quiet inconsistency. Here are the decisions I locked in.

First, Draw the Line Between KV Store and CloudKit

iCloud sync offers several options. For small data like settings, NSUbiquitousKeyValueStore is enough — a lightweight mechanism that syncs key-value pairs only. Its capacity is around 1 MB, and it is not suited to a collection of structured records.

For data whose count grows — items the user creates like notes, favorites, collections — put it in CloudKit with CKRecord. My line: "fixed count addressable by key, use the KV store; variable count you will want to query, use CloudKit." Make that call up front, or you will later cram records into the KV store and break.

Saving a CloudKit record looks like this:

import CloudKit
 
struct FavoriteRecord {
    let id: CKRecord.ID
    var title: String
    var updatedAt: Date
}
 
func save(_ favorite: FavoriteRecord) async throws {
    let db = CKContainer.default().privateCloudDatabase
    let record = CKRecord(recordType: "Favorite", recordID: favorite.id)
    record["title"] = favorite.title
    record["updatedAt"] = favorite.updatedAt
    _ = try await db.save(record)
}

That part is easy. The trouble is what comes next.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Understand the boundary between NSUbiquitousKeyValueStore and CloudKit (CKRecord), and decide which to use
Learn the code to resolve conflicts when two devices edit the same record, using the server change token and changeTag
Reproduce the tombstone pattern that prevents 'zombie resurrection' when syncing deletes
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

Dev Tools2026-06-15
Drawing the Line Between Rork Max's Swift Output and the Expo Build
Rork Max now generates native Swift, while the standard Rork keeps producing Expo (React Native) apps. Here is how to split responsibilities between the two engines inside a single app business, viewed from real maintenance cost.
Dev Tools2026-06-17
Why Your Rork Max Native Swift Widget Freezes After Day One — Designing the TimelineProvider Refresh Budget
Native Swift home screen widgets generated by Rork Max stop rotating after the first day unless you understand the TimelineProvider refresh budget. Here is how reloadPolicy, App Groups, and deep links fit together in a real app.
Dev Tools2026-06-16
Putting Your Rork Max Native App's Content into iPhone Search — Becoming a 'Findable' App with Core Spotlight
Index the content of the native Swift app Rork Max generates into Core Spotlight, so users reach a specific in-app screen straight from iPhone search. Covers adding, updating, and removing index entries, plus the production trap of stale search results, from an indie developer's view.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →