Re: Translate Services Menu to Swift

Quincey Morris

On Jul 15, 2018, at 03:47 , Gerriet M. Denkmann <g@...> wrote:

Now this is ok:
@objc func nnn(_ pboard: NSPasteboard, _ userData: String)

Where nnn = value of “Instance Method name” from Info.plist

This doesn’t look right, and I don’t know why it works. If you put the name “nnn” in the info.plist, the selector it looks up should be “nnn:userData:error:”. The Swift 4 function signature that translates into this selector would be:

@objc func nnn(_ pboard: NSPasteboard, userData: String, error: NSErrorPointer)

It’s possible that the service lookup tries a number of variant selectors (like KVC does for accessors), for backwards compatibility with older naming conventions, and you were lucky enough to hit on one that works. If you’re interested, it might be worth trying that last function signature to see if that works too.

Join { to automatically receive all group messages.