In core data if we have multi value relationship, such as when a business can have several keywords, in the subclass NSManagedObject generator, Apple will use NSOrderedSet instead of NSArray.
They are both almost equal except that checking ownership is slightly faster in NSOrderedSet.
Any reason why Apple doesn’t use the far more familiar and famous NSArray?
My guess would be: Because
NSOrderedSetmanages a collection of distinct elements, similar toNSSetfor unordered relationships.With
NSArrayyou could create an object which is related to another object more than once.