With TextFields I can provide a closure in the onEditingChange parameter which fires when editing starts and editing ends (a Bool indicating start/end). I can also provide a closure in the onCommit parameter which fires when enter is pressed.
So, for instance when editing starts, I can change the foreground colour and change it back when I switch to another TextField (editing ends) or press enter (Commit).
However, if I start editing and then hit a Button control, neither closure fires. This is surely a bud??
I’ve done much better than that! I’ve developed a nice generics-based CustomFieldstruct which handles Strings, Ints, Doubles, Arrays and a range of multi-field custom types such as ProbabilityDistributions and Partitions all supporting validation on both individual fields and multi-fields based on this simple initialiser:
here below (I hope) is a version that handles a range of single data type such as string. int, double. It’s easy to add protocol conformance for other such types.
I’ve removed the code for collection types because its a not quite to my satisfaction yet. I’ll add it when I’m happy with it.
Comments will be welcome.