On 9 Aug 2014, at 16:20, Quincey Morris <[email protected]> 
wrote:

> On Aug 8, 2014, at 23:48 , Gerriet M. Denkmann <[email protected]> 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.

Thanks a lot!
This indeed works perfectly.


Kind regards,

Gerriet.


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to