cocoabits / MASShortcut

Modern framework for managing global keyboard shortcuts compatible with Mac App Store. More details:
http://blog.shpakovski.com/2012/07/global-keyboard-shortcuts-in-cocoa.html
BSD 2-Clause "Simplified" License
1.52k stars 220 forks source link

xcode 6.2 compiling issues. #36

Closed eicca closed 10 years ago

eicca commented 10 years ago

Hello.

I'm using xcode beta and I'm trying to use MASShortcut within a swift project.

After importing MASShortcut in bridging header file I'm getting the following error during compilation:

<unknown>:0: error: /path/to/project/Pods/Headers/MASShortcut/MASShortcut.h:49: expected a type

And this is a MASShortcut.h:49:

+ (MASShortcut *)shortcutWithEvent:(NSEvent *)anEvent;

Maybe NSEvent is not in the carbon anymore?

I solved the issue by adding #import <Cocoa/Cocoa.h> on top of the MASShortcut.h, but I'm unsure if it's a proper solution. Also, if the problem is related to api changes, maybe it'd be a good idea to add the fix to the library as well.

Thanks.

shpakovski commented 10 years ago

Hi, thank you for the problem report. I assume NSEvent is declared in Cocoa.h, but the bridging header does not import this file. Could you please try to move the line #import <Cocoa/Cocoa.h> into the file ...-Bridging-Header.h or something like this? Sorry for the late reply.

eicca commented 10 years ago

Thanks, this works perfectly. Sorry for the trivial question ;)

shpakovski commented 10 years ago

No problem, glad it helped! :)