I am collecting identifiers in an array from an array of dictionaries like this
NSArray *places= @[
{place_id = @"3dsfdDfGDH";
place_url = @"/Peru/Lambayeque/Chiclayo";
place_name = @"Peru";}
,
{place_id = @"HUHiKcZVU7ItMyQ";
place_url = @"/Peru/La+Libertad/Huanchaco";
place_name = @"Peru";}
,
{place_id = @"7JL1K5FVUbg0vg";
place_url = @"/United+Kingdom/England/Buckley+Hill";
place_name = @"United Kingdom";}
];
NSArray *placeIds= [places valueForKeyPath:place_id];
It works fine, but what I want is a different array with place_id as well as place_url but NOT Name. sort of
I want NSArray * PlaceIdAndURL to have dictionaries like below
@[
{place_id = @"3dsfdDfGDH";
place_url = @"/Peru/Lambayeque/Chiclayo";}
,
{place_id = @"HUHiKcZVU7ItMyQ";
place_url = @"/Peru/La+Libertad/Huanchaco";}
,
{place_id = @"7JL1K5FVUbg0vg";
place_url = @"/United+Kingdom/England/Buckley+Hill";}
];
How can I get without a loop an entire array, like the one I had first with ValueForKeyPathabove
source
share