I\'ve been trying to replicate the usual way of doing this in Objective-C in Swift for a new swift app I\'m playing around with.
How to do this in Objective-C is wel
I found that as of Xcode 8.2 I needed to convert MagerValp's code to the following:
func applicationWillFinishLaunching(_ notification: Notification) {
let aem = NSAppleEventManager.shared();
aem.setEventHandler(self, andSelector: Selector(("handleGetURLEvent:withReplyEvent:")), forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))
}
Hope this helps.
As far as I can tell from the documentation the classes takes the constant and converts it to the proper type:
func applicationWillFinishLaunching(aNotification: NSNotification?) {
var appleEventManager:NSAppleEventManager = NSAppleEventManager.sharedAppleEventManager()
appleEventManager.setEventHandler(self, andSelector: "handleGetURLEvent:withReplyEvent:", forEventClass: AEEventClass(kInternetEventClass), andEventID: AEEventID(kAEGetURL))
}