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

One to Many Relationships not supported #202

Closed
fstigre opened this issue Jun 28, 2020 · 9 comments · Fixed by #206
Closed

One to Many Relationships not supported #202

fstigre opened this issue Jun 28, 2020 · 9 comments · Fixed by #206

Comments

@fstigre
Copy link

fstigre commented Jun 28, 2020

First of all, let me thank you all for the awesome framework, I can't believe how easy it is to sync data with IceCream it is really like magic.

I currently have a project where I'm using a One-to- many relationships in Realm using the List method let dogs = List<Dog>() but I tried it and IceCream does not create the right relationship in CloudKit dashboard.

Can someone please confirm that let dogs = List<Dog>() is not supported in IceCream and that the only option would be using the LinkingObject option, let dogs = LinkingObjects(fromType: Dog.self, property: "owner")?

Thanks a lot!

@caiyue1993
Copy link
Owner

Yes, I can confirm that. We're still working on the support of List data structure.

@fstigre
Copy link
Author

fstigre commented Jun 28, 2020

Thank you for the confirmation. Keep up the good work, IceCream it's awesome!

@fstigre
Copy link
Author

fstigre commented Jun 30, 2020

One last question, Is the LinkingObjects recommended for One to Many relationships? Has anyone done it?

@caiyue1993
Copy link
Owner

caiyue1993 commented Jun 30, 2020

Yes, as it said in the README file:

Thanks to the CKReference in the CloudKit, IceCream has supported many-to-one relationship nicely. As the Dog example shows, a dog may have an owner. And we'll wrap the owner up as CKReference and push them to the CloudKit.
Inversely, the Person object has a dogs property which is the type of LinkingObjects. So we've successfully supported to-many relationship with a nice workaround. All make sense.

@fstigre
Copy link
Author

fstigre commented Jun 30, 2020

@caiyue1993 The README file only mentions the Many-to-One relationship but nothing about One-to-Many. Is the LinkingObjects recommended for both, the Many-to-One and One-to-Many relationships?

@caiyue1993
Copy link
Owner

caiyue1993 commented Jun 30, 2020

Let me clarify this. The List structure is still not supported in IceCream and you can only use type LinkingObjects to implement to-many relationship as a workaround. If you are only using many-to-one(for example, Dog has an owner property which is Person type), you don't need to use LinkingObjects at all.
You can give it a try :)

@fstigre
Copy link
Author

fstigre commented Jun 30, 2020

Again, I'm using One-to-Many NOT Many-to-One. Any idea when List will be supported? The library it's awesome but the List is a must for me. I'm definitely willing to donate to get that feature and I'm sure a lot more people would donate too.

@caiyue1993
Copy link
Owner

I'm currently spending my leisure time working on this feature. It makes sense and you could try looking at the #206 in advance.

@caiyue1993
Copy link
Owner

caiyue1993 commented Feb 8, 2021

Hi @fstigre,
I don't know whether you are still sticking around, but I'd like to say that the issue that you described has been fixed in the #206. I'm sorry for the delay and thanks for the donation that you appealed in another ticket.

Please refer to the README for the detailed usage. Just let me know if you encounter other issues. Thank you again.

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

Successfully merging a pull request may close this issue.

2 participants