• 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: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data)


  • Subject: Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data)
  • From: Ken Thomases <email@hidden>
  • Date: Fri, 11 Feb 2011 09:33:44 -0600

On Feb 11, 2011, at 9:19 AM, Michael Crawford wrote:

> Thank you both for your suggestions.

You're welcome.  I'm glad I could help.

> I ended up going with Ken's idea regarding the synthetic property.  It was added to a NSManagedObject derived class so I couldn't use it during the fetch request without actually adding an attribute but I did use it to sort the resulting array.  The synthetic property computes an priority index when invoked.  It performs very well.

By the way, I neglected to mention that you should also implement +keyPathsForValuesAffecting<Key> for your synthetic property returning the set of key paths which affect its value (e.g. the genre property).  That's necessary for the synthetic property to be properly KVO-compliant.  This should be standard operating procedure for all synthetic/derived properties.

Cheers,
Ken

_______________________________________________

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

References: 
 >Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data) (From: Michael Crawford <email@hidden>)
 >Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data) (From: Ken Thomases <email@hidden>)
 >Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data) (From: Ernesto Giannotta <email@hidden>)
 >Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data) (From: Michael Crawford <email@hidden>)

  • Prev by Date: Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data)
  • Next by Date: Carbon overlay window in place of a cocoa view
  • Previous by thread: Re: Need help sorting with NSSortDescriptor and/or/NSPredicate (Core Data)
  • Next by thread: NSDocument Question
  • Index(es):
    • Date
    • Thread