Re: Swift and NSXPCInterface
Re: Swift and NSXPCInterface
- Subject: Re: Swift and NSXPCInterface
- From: Quincey Morris <email@hidden>
- Date: Sat, 09 Aug 2014 02:20:08 -0700
On Aug 8, 2014, at 23:48 , Gerriet M. Denkmann <email@hidden> wrote:
> let b = NSXPCInterface( protocol: Xpc_CommonProtocol )
When I try it, the “protocol” is syntax highlighted as a keyword, so I suspect that’s the first problem. Taking a cue from the declaration of NSXPCInterface itself, I can fix that problem like this (using a protocol that exists for me, just for this test):
let b = NSXPCInterface( `protocol`: NSTableViewDelegate )
After that, the compiler gives another error, and offers to fix it to:
let b = NSXPCInterface( `protocol`: NSTableViewDelegate.self )
which compiled without error.
Then I tried declaring a protocol called ‘Xpc_CommonProtocol’ and using it instead:
protocol Xpc_CommonProtocol {}
let b = NSXPCInterface( `protocol`: Xpc_CommonProtocol.self )
and that fails with a hard-to-interpret error about type “Protocol”. Fiddling around, I changed it to:
@objc protocol Xpc_CommonProtocol {}
let b = NSXPCInterface( `protocol`: Xpc_CommonProtocol.self )
and it compiled. I guess it makes sense that it has to be an Obj-C protocol, but getting there isn’t at all obvious.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden