I was able to cook something up with constraints and computing the styles for the date formatter with an offscreen label, then taking the best fitting style and using it on the onscreen label. BUT I'm still a teeny bit nervous about all this because:
Changing the date format style causes..
the stringValue of the NSTextField to change which can cause..
The text field to invalidate its intrinsic content size (sometimes I guess).
I don't really know my bounding width until I'm in layout. It's easy to avoid infinite loops in my code but autolayout with its strict exceptions and rules, implicit layout invalidation etc., it is not so easy to guard against rules that are not well documented. B/C autolayout claims it is not legal to change layout in the middle of layout how can I change the date format safely during layout?
I'm not hitting the exception anymore which is good but as an extra precaution I have my NSTextFIeld subclass override -invalidateIntrinsicContentSize and do nothing..because I don't want setStringValue: to invalidate the layout, I want to adjust the .stringValue to live within the layout I already have. I hope that makes sense.
Please don't be so strict throwing exceptions in Autolayout! Layout bugs, overlapping views, etc are typically not fatal errors IMO.
Sincerely,
Macho