• 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: Mon, 31 May 2010 02:57:55 -0700

(reposted to the correct list)

On May 31, 2010, at 01:58, Ken Thomases wrote:

> I haven't tested to be sure, but I believe there's a third possibility.  You can make the model key path "self" and write the value transformer to transform from the the whole object to a color.  It can inspect multiple properties of the object to accomplish that.

That's a neat solution, but to anyone who might actually contemplate using any kind of value transformer in the scenario being discussed, I'd suggest that a value transformer solution has *no* advantages whatsoever, plus several disadvantages, compared to providing a property on the model object, unless:

a. The value transformer is generally useful on objects of a number of different classes, or

b. You can't modify the class for some reason


P.S. It occurs to me that there *is* a flaw in your proposal, isn't there? -- it's not KVO compliant for either of the properties that really affect the intended color. Providing a +keyPathsForValuesAffectingSelf method would work, I guess, but it's quite ugly. And involves the class source code in a way that the whole value transformer thing was trying to avoid.

_______________________________________________

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: Reinhard Segeler <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>)
 >Re: Value Transformer with multiple Model Key Paths (From: Quincey Morris <email@hidden>)
 >Re: Value Transformer with multiple Model Key Paths (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: UTI strings
  • Next by Date: Disabling scrolling while showing a floating window
  • 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