• 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: NSArray instance variable and core data objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray instance variable and core data objects


  • Subject: Re: NSArray instance variable and core data objects
  • From: mmalc crawford <email@hidden>
  • Date: Sun, 4 Mar 2007 07:49:18 -0800


On Mar 4, 2007, at 6:20 AM, Tim McDonald wrote:

Apart from the questions Timothy asked:

The order in which the values are retrieved is important therefore I was attempting to create a NSArray instance variable to store an ordered list of managed objects.

How are you intending to use and store the array?
Is there any attribute on which you could simply sort the input characteristic types?


from source file:
inputCharacteristicTypes = [NSArray arrayWithArray:[[self mutableSetValueForKey:@"inputCharacteristicTypes"] allObjects]];


This is unnecessarily inefficient.
There is no need to create a mutable proxy ('mutableSetValueForKey:') since you don't use it; 'allObjects' returns a new array, so there is no need to create another array using it.


inputCharacteristicTypes = [[self valueForKey:@"inputCharacteristicTypes"] allObjects];

Perhaps you meant:

inputCharacteristicTypes = [NSMutableArray arrayWithArray:[[self valueForKey:@"inputCharacteristicTypes"] allObjects]];

Note that obviously the order you get objects back from the set is not fixed, so you will have to sort them somehow (see question above).

mmalc


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: NSArray instance variable and core data objects
      • From: Tim McDonald <email@hidden>
References: 
 >NSArray instance variable and core data objects (From: Tim McDonald <email@hidden>)

  • Prev by Date: Re: NSUserDefaults won't do as it's told
  • Next by Date: i-bar not blinking
  • Previous by thread: Re: NSArray instance variable and core data objects
  • Next by thread: Re: NSArray instance variable and core data objects
  • Index(es):
    • Date
    • Thread