Uniqueness of Core Data

Is there any way to check the value updated in a property of a Core Data object with the property values โ€‹โ€‹in other objects in the collection?

I am currently creating an object with some default values, add it to arrangedObjects , and then ask the user to change various property values. However, I would like to check a specific property and make sure that there are no other objects in the array with the same value for this property. What is the best way to do this?

Thanks a lot, Dani.

+1
source share
1 answer

Manual validation is just a few lines of code with a fast enumeration loop:

 BOOL unique = YES; for (NSManagedObject *obj in collection) { if (obj.property == value) { unique = NO; break; } } 
0
source

All Articles