Search code examples
macoscore-datanstextfield

Enforcing Max Length in a NSTextField with binding to CoreData String


A NSTextField is bound to a Core Data entity string object. In the core data model the string has a max length of n characters.

Is there an elegant way to enforce this same limit on the NSTextField using bindings, or is the only way to programmatically (say in the text field delegate) evaluate the length on a character by character basis?


Solution

  • No. There is no elegant way. I enforced the length in the textfield's delegate.