This pull request has two parts (monomac and maccore).
In combination with data binding this allows to get the standard "Please provide a valid value." dialogs.
Allow creating custom NSFormatters. In combination with data binding …
…this allows to get the standard "Please provide a valid value." dialogs.
Made methods in NSFormatterDelegate that through an exception when no…
…t implemented abstract, so the developer has to implement them (StringFor, ObjectFor).
I am hesitant to add this code as is, because of the subclass of NSFormatter that is introduced. Both because of its naming and because I do not really understand if this is the right approach.
Do you have a pointer to an Objective-C sample that shows how people are actually using this?
I am hesitant, too, probably the MonoMac users should subclass NSFormatter, but it requires a lot of research, at least the way I did it. (IntPtrs) I wanted to spare them the work and the errors. It would be great if you could build a better solution.
First there is the Creating a Custom Formatter document from apple:
Then there is this guide:
You can subclass NSFormatter for conversion and for validation. Here is what OS X will display if the validation fails:
The first link didn't work, here the correct one https://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Conceptual/DataFormatting/Articles/CreatingACustomFormatter.html
The name for the subclass is likely wrong, the pattern for Foo and FooDelegate is that Foo has a property called Delegate that points to a FooDelegate. In this case FooDelegate is a subclass of Foo.
What about NSCustomFormatter? This should indicate the purpose without violating the naming convention.