How to make Entity unique constraints in Core Data case insensitive? I have an Entity that is keep unique by "name" property.
I've added target property in constraints, set context.mergePolicy = NSMergePolicy.rollback . Works correct here, skip entities with the same name.
But I want to skip aPpleS when I already have Apples. How to achieve that using merge policy? Does any Core Data solution where I can get case insensitive behavior?
You could just add a 'name_lowercased' attribute to your data model and make this your unique constraint instead. You can fill your object property with your 'name' and a .lowercased() call then.
After all the name "aPpleS" is different from "Apples".
If you really don't want that, there also is the option to implement your own MergePolicy, but that seems to be too much for your case.