• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Value Transformer with multiple Model Key Paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Value Transformer with multiple Model Key Paths


  • Subject: Re: Value Transformer with multiple Model Key Paths
  • From: Quincey Morris <email@hidden>
  • Date: Sun, 30 May 2010 21:46:21 -0700

On May 30, 2010, at 18:11, Markus Spoettl wrote:

> What I usually do in such situations is create an artificial property on the model object that combines the state of multiple properties into one value. In your case that properties could return
>
> (a) another value that you transform into a color or
>
> (b) it could return the color directly.
>
> I know that violates the MVC paradigm, but it's a very simple and efficient solution - meaning least amount of code necessary.

Your two proposals are both viable, and, in fact, neither of these solutions violates the MVC paradigm in any way. The property that you create doesn't add any knowledge of the actual UI to your data model, nor does it establish any special or privileged line of communication between the model and the view. It's just a property of the model -- "a color suitable for representing the current state of this object" -- that's available to any "client" of the model for whatever purpose. The returned color could (for example) be used as a key to a NSDictionary, if that happened to be useful somewhere else in the application.

If having a color property is nevertheless distasteful, solution (a) is an equally valid alternative.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Value Transformer with multiple Model Key Paths
      • From: Ken Thomases <email@hidden>
    • Re: Value Transformer with multiple Model Key Paths
      • From: Markus Spoettl <email@hidden>
References: 
 >Value Transformer with multiple Model Key Paths (From: Mikael Wämundson <email@hidden>)
 >Re: Value Transformer with multiple Model Key Paths (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: Notification of file system modification arrives too early?
  • Next by Date: Re: Notification of file system modification arrives too early?
  • Previous by thread: Re: Value Transformer with multiple Model Key Paths
  • Next by thread: Re: Value Transformer with multiple Model Key Paths
  • Index(es):
    • Date
    • Thread