On Feb 27, 2010, at 11:34 PM, Jean-Henri Duteau wrote: > BTW, I've already considered a Transformer. The problem with that is one of > code bloat - I have multiple fields on the view that are derived from this > one attribute. I haven't figured out a way at design time in IB to make one > transformer handle the different transformations.
Maybe instead of being a single attribute (by which you mean it’s a string, URL or some such value class), your model object should have a relationship to another model object that you can manipulate more directly. Then that other model object can have a -stringValue or -URLValue (or whatever) method to “format” itself as the appropriate value class when you really it in that form. (And perhaps a setter or initializer from that value type as well.) For example, if I were writing a file-transfer application, I wouldn’t directly use NSURL to represent the host, port, directory, protocol, etc. I’d use some other (fully mutable) model object that can return itself as a URL. My UI would be bound to that other model object, and only when I need a full URL would I ask that other model object for an equivalent NSURL instance. — Chris _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com