Re: NSArray instance variable and core data objects
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