Swift and NSXPCInterface
Swift and NSXPCInterface
- Subject: Swift and NSXPCInterface
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 09 Aug 2014 13:48:20 +0700
I am trying to translate this:
NSXPCInterface *b = [NSXPCInterface interfaceWithProtocol:@protocol(Xpc_CommonProtocol)];
to Swift.
This compiles (and runs) as expected:
var dummy : AnyObject?
if let protoDummi = dummy as? Xpc_CommonProtocol
{
println("dummy DOES implement Xpc_CommonProtocol")
}
else
{
println("dummy does NOT implement Xpc_CommonProtocol") // this does print
}
which seems to prove that Swift knows about by protocol.
But this line:
let b = NSXPCInterface( protocol: Xpc_CommonProtocol )
creates a lot of errors:
:27: Expected expression in list of expressions
:27: Expected ',' separator
:27: Expected ')' in expression list
:26: Consecutive statements on a line must be separated by ';'
:35: Expected identifier in protocol declaration
:7: Constant 'b' inferred to have type '()', which may be unexpected <-- Indeed it is!
What do I have to do to get my NSXPCInterface?
Xcode 6 beta 5; 11.9.4
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