iswiftapp / iswift

Objective-C to Swift Converter
30 stars 3 forks source link

Blocks as methods parameters #184

Open smic opened 8 years ago

smic commented 8 years ago

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
kennebecstars commented 8 years ago

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");
JanX2 commented 4 years ago

I have the same issue with this file in version 4.2:

https://github.com/JanX2/Transcriptions/blob/6810467844df3321396496a8a7624b0b6cce58c5/TSCAppDelegate.m#L180