Re: Use of blocks
Re: Use of blocks
- Subject: Re: Use of blocks
- From: Keith Duncan <email@hidden>
- Date: Mon, 12 Jul 2010 15:31:13 +0100
> overkill. You can get less, faster code by using a for/in loop:
>
> float minValue = INFINITY;
> for(id obj in someTrips)
> minValue = MIN(minValue, [[obj adultFinalPrice] floatValue]);
You could get even less, more expressive code, using key path operators:
NSNumber *minValue = [someTrips valueForKeyPath:@"@min.adultFinalPrice"];
NSNumber *maxValue = [someTrips valueForKeyPath:@"@max.adultFinalPrice"];
Keith
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden