I am developing an Objective-C macOS app that uses Core Data, and I am trying to enforce constraints, specifically a rather common one, to achieve a unique title for my entity. I have tried to follow the most recommended way, setting constraints for the entity in the model. As expected, the constraints are active and I cannot save the NSManagedObjectContext, however I would like to perform the validation immediately. From the docs:
How Validation Works in Core Data
How to validate is a model decision, when to validate is a user interface or controller-level decision. For example, a value binding for a text field might have its “validates immediately” option enabled. Moreover, at various times, inconsistencies are expected to arise in managed objects and object graphs.
I have a rather simple setup: A View-Based NSOutlineView driven by a NSTreeController, and a detail view, with basically NSTextFields bound to the treeController's selection. I have checked "Validates Immediately" both for the textfields in the details view, and for the textfield in the only cell type of the NSOutlineView. However, this seems to have no effect at all and I am still free to rename my managed object without Core Data intervening. I have already tried to turn off "update values continously", both in the binding settings and in the textfield's settings but with no success. Any clarification is highly appreciated. Thanks