Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many-to-many relationships and Core Data #174

Open
pedrommcarrasco opened this issue Jan 12, 2022 · 3 comments
Open

Many-to-many relationships and Core Data #174

pedrommcarrasco opened this issue Jan 12, 2022 · 3 comments

Comments

@pedrommcarrasco
Copy link

Are many-to-many relationships on Core Data still unsupported? 🤔

@mentrena
Copy link
Owner

Correct, CloudKit doesn't support them. CloudKit only supports many-to-one relationships by using a reference in each of the "many" records to the "one" record (see: https://developer.apple.com/documentation/cloudkit/ckrecord/reference)

@pedrommcarrasco
Copy link
Author

Out of curiosity, does NSPersistentCloudKitContainer support them? - didn't see much information around 🤔

@mentrena
Copy link
Owner

That's a good question, the most I found is this:

All relationships must be optional. Due to operation size limitations, CloudKit may not save relationship changes atomically.
All relationships must have an inverse, in case the records synchronize out of order.
CloudKit doesn’t support the Deny deletion rule.

which doesn't specifically say it doesn't support many-to-many, although in my head inverse relationships don't make sense in the case of many-to-many relationships. But I haven't tried it myself –nor have I really used NSPersistentCloudKitContainer.

Actually, after reading the docs for CKRecord again I see properties can be arrays of references, so I think it should be possible to support many-to-many relationships. I'll have a try at adding support as time allows :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants