• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swift and NSXPCInterface
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift and NSXPCInterface


  • Subject: Re: Swift and NSXPCInterface
  • From: "Gerriet M. Denkmann" <email@hidden>
  • Date: Sat, 09 Aug 2014 16:29:25 +0700

On 9 Aug 2014, at 16:20, Quincey Morris <email@hidden> wrote:

> 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.

Thanks a lot!
This indeed works perfectly.


Kind regards,

Gerriet.


_______________________________________________

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


References: 
 >Swift and NSXPCInterface (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Swift and NSXPCInterface (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Swift and NSXPCInterface
  • Next by Date: Re: Does NSPointerArray support zeroing weak references under ARC
  • Previous by thread: Re: Swift and NSXPCInterface
  • Next by thread: Does NSPointerArray support zeroing weak references under ARC
  • Index(es):
    • Date
    • Thread