Last active
January 2, 2016 03:29
-
-
Save paulrehkugler/8243948 to your computer and use it in GitHub Desktop.
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
- (id)initWithCancelButtonTitle:(NSString *)cancelTitle otherButtonTitles:(NSString *)otherButtonTitles, ... { | |
if (self = [super init]) { | |
NSMutableArray *buttonTitles = [[NSMutableArray alloc] init]; | |
BRYEachArgumentBlock eachArgumentBlock = ^(NSString *title) { | |
[buttonTitles addObject:title]; | |
}; | |
BRYVarArgs(eachArgumentBlock, otherButtonTitles); | |
} | |
return self; | |
} |
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
typedef void (^BRYEachArgumentBlock)(id argument); | |
void BRYVarArgs(BRYEachArgumentBlock eachArgumentBlock, id arguments, ...) { | |
if (arguments && eachArgumentBlock) { | |
va_list argumentList; | |
va_start(argumentList, arguments); | |
while ((argument = va_arg(argumentList, id))) { | |
eachArgumentBlock(argument); | |
} | |
va_end(argumentList); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment