Blocks as methods parameters #184

Open
smic opened this Issue Feb 6, 2016 · 1 comment

Projects

None yet

3 participants

@smic
smic commented Feb 6, 2016

The compiler seems to have a problem with blocks as method parameters like in following code:

@implementation NSUndoManager (SMBlocks)

- (void)groupUndoWithActionName:(NSString *)name block:(void(^)())block {
    [self beginUndoGrouping];

    block(self);

    [self endUndoGrouping];
    [self setActionName:name];
}

@end
@drkameleon drkameleon added the bug label Feb 6, 2016
@kennebecstars

Maybe this falls into the same category? From the Apple AstroLayout sample.

    UILayoutGuide *(^newLayoutGuide)(NSString *) = ^(NSString *identifierName){
        UILayoutGuide *newGuide = [[UILayoutGuide alloc] init];
        newGuide.identifier = identifierName;
        [self.view addLayoutGuide: newGuide];
        return newGuide;
    };
    UILayoutGuide *leadingMercuryGuide = newLayoutGuide(@"leadingMercuryGuide");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment