nevyn / SPMediaKeyTap

[Cocoa] SPMediaKeyTap is a global event tap for the play/pause, prev and next keys on the keyboard.
http://overooped.com/post/2593597587/mediakeys
Other
266 stars 44 forks source link

Swift #32

Open PierreBresson opened 8 years ago

PierreBresson commented 8 years ago

Hi,

I'm trying to include SPMediaKeyTrap in one of my project written in swift.

I get several errors in NSObject+SPInvocationGrabbing.m. For example :

screen shot 2015-11-28 at 17 55 10

Anyone knows how to fix these errors ?

Thanks :)

drewhamlin commented 8 years ago

Just went through this myself today. This file is easier to convert than the SPInvocationGrabbing file. (Once you fix this file, it's out of the frying pan and into the fire…)

For this file, you can just remove all of the troubled lines (and the other lines related to the NSAutoreleasePool). ARC handles memory management for you so dealloc, release, etc. aren't needed.

The other file requires you to add lots of "(__bridge )" casts to it. I've successfully converted both and the app is working, so it is possible! Good luck!