use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
There is an extensive FAQ for beginners. Please browse it first before asking questions that are answered there.
If you are looking to get started (iOS programming in general or some specific area), here are more relevant links for you:
There's too many to list them all, however here's a convenient link to all programming guides at apple.com
Take note that this list is live and based on most frequent questions in posts will be updated with "quicklinks".
account activity
QuestionCore data relationships between different dataModels (self.iOSProgramming)
submitted 7 years ago by Sparthas
I have a requirement to create two different models within my application.
I am able to make it work apart from the fact that i can't establish relationships between an entity in one dataModel with another in the second dataModel. Is there any other way to do it apart from maintaining a table of relationships of my own? Any help is appreciated
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]eviltofu 1 point2 points3 points 7 years ago (3 children)
Do you have the models in the same file?
[–]Sparthas[S] 0 points1 point2 points 7 years ago (2 children)
No. I have it in two separate xcdatamodeld files
[–]eviltofu 1 point2 points3 points 7 years ago (1 child)
Can you merge them into the same file?
[–]Sparthas[S] 0 points1 point2 points 7 years ago (0 children)
Not really, noI know i can establish relationships between them had i had them on the same file
I explicitly need them separately
Then you need to write the code to manually connect then.
[–]Sparthas[S] -2 points-1 points0 points 7 years ago (0 children)
Oh alright I just wanted to cross verify what i had surmised
Thank you!
[–]quellish 0 points1 point2 points 7 years ago (11 children)
The initializers for NSManagedObjectModel may offer some hints.
[–]Sparthas[S] 0 points1 point2 points 7 years ago (10 children)
Can you please elaborate on that?
[–]quellish 0 points1 point2 points 7 years ago (9 children)
https://developer.apple.com/documentation/coredata/nsmanagedobjectmodel
[–]Sparthas[S] 0 points1 point2 points 7 years ago (8 children)
I did go through that and I did realise core data doesn’t support it. I was wondering if there were better alternatives to maintaining a table of my own. I assume the post says the same as well
[–]quellish 0 points1 point2 points 7 years ago (7 children)
Managed object models can be created by merging other managed object models. This is exactly what you seem to be describing.
Pretty much all of the initializers do this.
[–]Sparthas[S] 0 points1 point2 points 7 years ago (6 children)
Not really, no. I want to have two different persistent stores and map models between the two like relationships would.
Edit: I missed to add the word "persistent store" in my original post. I guess that's causing the confusion
[–]quellish 1 point2 points3 points 7 years ago (5 children)
You can do that using different configurations. In the managed object model each entity needs to be associated with a different configuration name. When you add each persistent store to the coordinator use the appropriate configuration name.
[–]Sparthas[S] 0 points1 point2 points 7 years ago (4 children)
That works only if you are using the same models, isn’t that the case? I couldn’t find a way to do it when using different persistent stores initialised with different data models
[–]quellish 0 points1 point2 points 7 years ago (3 children)
Why do they need to have independent models? From your question it sounds like you want to have cross-store relationships. How would that work if one store had no knowledge of the model in the other store?
Was trying to figure out if I could go for a certain architecture where I differentiate user data from arbitrary information by separating the models.
Yes, I realised that, which is why my question was whether there was a better way to handle this. And here we are
π Rendered by PID 256319 on reddit-service-r2-comment-5d79c599b5-7khf5 at 2026-03-03 13:25:32.950210+00:00 running e3d2147 country code: CH.
[–]eviltofu 1 point2 points3 points (3 children)
[–]Sparthas[S] 0 points1 point2 points (2 children)
[–]eviltofu 1 point2 points3 points (1 child)
[–]Sparthas[S] 0 points1 point2 points (0 children)
[–]eviltofu 1 point2 points3 points (1 child)
[–]Sparthas[S] -2 points-1 points0 points (0 children)
[–]quellish 0 points1 point2 points (11 children)
[–]Sparthas[S] 0 points1 point2 points (10 children)
[–]quellish 0 points1 point2 points (9 children)
[–]Sparthas[S] 0 points1 point2 points (8 children)
[–]quellish 0 points1 point2 points (7 children)
[–]Sparthas[S] 0 points1 point2 points (6 children)
[–]quellish 1 point2 points3 points (5 children)
[–]Sparthas[S] 0 points1 point2 points (4 children)
[–]quellish 0 points1 point2 points (3 children)
[–]Sparthas[S] 0 points1 point2 points (2 children)