Clicky

iOS Dev Nugget 42 #valueForKey on NSArrays

.

Need to run a code review on your codebase? Hire me

Often, you'll write code like:

NSMutableArray* names = [NSMutableArray array];
for (SomeObject* each in someArray) {
    [names addObject:each.someNameProperty];
}

You can shorten it to:

NSArray* names = [someArray valueForKey:@"someNameProperty"];


Your feedback is valuable: Do you want more nuggets like this?   Yes   or   No

.

Like this and want such iOS dev nuggets to be emailed to you, weekly?

Sign Me Up! or follow @iosdevnuggets on Twitter

.

View archives of past issues