Last active
December 17, 2015 19:09
-
-
Save ashfurrow/5658708 to your computer and use it in GitHub Desktop.
ReactiveCocoa Find Max Value in Array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CGFloat max = [[numbersArray.rac_sequence foldLeftWithStart:@(FLT_MIN) combine:^id(id accumulator, id value) { | |
if (value == [NSNull null]) return accumulator; | |
if ([accumulator floatValue] < [value floatValue]) return value; | |
else return accumulator; | |
}] floatValue]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment