Category Archives: Core Data

How to implement Unique Constraints in Core Data with iOS 9

With iOS 9, Apple introduces Unique Constraints for Core Data. This new feature was briefly demonstrated at WWDC in June (Session 220). When I tried to implement it, I came across a few pitfalls and unexpected behavior, so I thought this might be worth a blog post.

Unique Constraints are a way to declare a custom attribute to be unique across all instances of an entity. Its intended use case is the import of external data that should be merged with existing objects in the database.
Continue reading How to implement Unique Constraints in Core Data with iOS 9