Hi all.  

I've got an array that has KVP dicts in each record that report a Name property 
and a GPS string.

Is there any lovely one liner that is able to return the values of a specific 
property for all elements in the array of dicts as an array of those values?

Like so:

I'd like to go from:

myArray: 
(
        {
        Name = "Puppies";
        geocode = "42.40283381228625, -71.2597588506239";
    },
        {
        Name = "Kittens";
        geocode = "42.40283381228625, -71.2597588506239";
    }
)

to:

myNameArray: 
(
    "Puppies",
    "Kittens"
)


I know I can do this and add the NSStrings to a NSMutableArray, then convert 
that to an NSArray, but I was hoping the experts already have this in a much 
cleaner approach.

        for (NSDictionary *myArrayMember in myArray) {
                NSString *nameValue = [myArrayMember objectForKey:@"Name"];
                // add NameValue String to array here.
                NSLog(@" %@", nameValue);
        }
        
Thanks in advance,
- Alex Zavatone



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to