Last active
August 29, 2015 14:26
-
-
Save bjhomer/81f7072fe88e2f5daafa to your computer and use it in GitHub Desktop.
Block typedef broken-ness in Xcode 7 beta 5
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
#import <Foundation/Foundation.h> | |
// This is pretty simple, right? | |
typedef void(^SampleBlock)(NSString *str); |
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
// Huh? UnsafeMutablePointer? Int32? In a 64-bit target? | |
public typealias SampleBlock = @convention(block) (UnsafeMutablePointer<Int32>) -> Void |
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
#import <Foundation/Foundation.h> | |
@class NSString; // Yes, even though we just imported Foundation, this makes a difference. | |
typedef void(^SampleBlock)(NSString *str); |
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
// Look! Now we have a real type! | |
public typealias SampleBlock = @convention(block) (String!) -> Void |
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
#import <Foundation/Foundation.h> | |
// Yeah, this totally won't compile. I wonder what Swift will think? | |
typedef void(^SampleBlock)(asdf *str); |
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
// Aha. So "UnsafeMutablePointer<Int32>" basically means "a pointer to some symbol I know nothing about." | |
public typealias SampleBlock = @convention(block) (UnsafeMutablePointer<Int32>) -> Void | |
// Basically, it looks like imported symbols aren't visible within typedef'd block parameters. Or something. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment