问题
Is there like an official workaround with protocols and types that are not supported in Object C
As an example, I have a protocol that returns a reactive cocoa signal producer
public protocol PLoginService {
func login(username:String,password:String) -> SignalProducer<Bool,NSError>
}
If I use @objc on the protocol, then I will get the compiler error that the return type is not supported in Objective C. I will have a lot of constructions like this, so I was wondering what I can do in order to benefit from the Typhoon magic
回答1:
The current version of Typhoon is a reflective and dynamic dependency injection container, and therefore relies on the full Objective-C run-time. This means that, unfortunately, all protocols that will pass through Typhoon must have the @objc
directive. Also, anything that Typhoon injects must be an Objective-C compatible type.
We're currently doing R&D on a pure Swift version of Typhoon, and you'd be most welcome to participate in the development of that project on Github.
来源:https://stackoverflow.com/questions/31661815/typhoon-and-objc-limitation-in-protocols