Sharing data is the right answer. Reference data should not be synchronized with the cloud, especially since iCloud has soft restrictions on the fact that it will allow the program to synchronize and store in documents.
To create soft links in stores (they donβt need to be SQLite, but this is a good idea for the overall performance of the application), you will need to have some unique key that can be referenced from the other side; good old fashioned foreign key.
From there, you can create the selected property in the model to reference the object.
While this relationship cannot be ordered directly, you can create an order through the sort index, or if it has a logical sort, then you can sort it after receiving the data (I use convenient methods for this, which return the sorted array instead of installed).
I can create an example, but you're really on the right track. The only interesting part is migration. When you discover a migration situation, you will need to migrate each store independently until when you create your main data stack. It sounds complicated, but it really is not that difficult.
Example
Imagine that there is a UserBar object in the user repository and a RefBar object in the link repository. After that, the RefBar will have a "fetchedProperty" relationship with the UserBar, thereby creating a ToOne relationship.
UserBar ---------- refBarID : NSInteger RefBar -------- identifier : NSInteger
Then you can create the selected property in the RefBar object in the model with a predicate:
$ FETCHED_PROPERTY.refBarID == identifier
Lets you name the predicate "userBarFetched"
Now that the array is returned, so we want to add a convenience method to the RefBar
@class UserBar; @interface RefBar : NSManagedObject - (UserBar*)userBar; @end @implementation RefBar - (UserBar*)userBar { NSArray *fetched = [self valueForKey:@"userBarFetched"]; return [fetched lastObject]; } @end
To create ToMany is the same, except that your convenience method returns an array, and you must sort the array before returning it.
As Heath Borders mentioned, you can add sorting to NSFetchedProperty if you want, but you have to do this in code. Personally, I always considered it wasteful and did not use this function. Perhaps it would be more useful if I could set the sort in the modeler.
Using ObjectID
I do not recommend using an ObjectID or URIR representation. The ObjectID (and therefore the URIR representation of this ObjectID) can and will change. Whenever you migrate a database whose value changes. You are much better off creating an immutable GUID.
Weak ratio
You need only one value on the M side of the relationship and which stores the external identifier. In your subclass of objects, you only need to implement accessors that retrieve the object (or objects).