-
Type:
Task
-
Resolution: Won't Fix
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
Problem
Right now I'm using SwiftData along with SwiftUI in an iOS app and wish to add cloud sync. The only choice in iOS17 is to use Apple's default CloudKit store for SwiftData which has some serious problems for production, primarily lack of support for unique constraints which to duplicate records for multi-device scenarios that is not easily solvable. This problem is specific to the CloudKit backend, not SwiftData itself which fully supports both a per property @Attribute(.unique) var name: String as well as compound (new in iOS18) attributes: `@Model
class Trip {
#Unique<Trip>([\.name, \.startDate, \.endDate])` I really want to use Realm although realm doesn't support watchOS currently which is a separate issue.
That aside, if Realm could plug in to SwiftData I'd be able to have the best of both worlds.
Solution
In iOS18 apple is introducing a provider model for stores as shown in this talk https://developer.apple.com/wwdc24/10138 and described in what's new in their docs: https://developer.apple.com/documentation/Updates/SwiftData. If realm supports this it will provide an easy, compatible on-ramp to realm for SwiftData users like me.
Alternatives
I could adopt the Realm iOS SDK but that paints me into a corner I don't want to be trapped in. Whichever cloud provider is first to support SwiftData for a data sync will be my first choice. I hope that's Realm.
How important is this improvement for you?
Dealbreaker
Feature would mainly be used with
Atlas Device Sync