在苹果发布Swift语言之后,ReactiveCocoa使用Swift进行了重写。该框架创建了一个桥用来连接Swift和Objective-CAPI(ReactiveSwift和ReactiveObjC)。
示例代码:
extension ActionProtocol where Input: AnyObject, Output: AnyObject { func toRACCommand() -> RACCommand<Input, Output>}extension ActionProtocol where Input: OptionalProtocol, Input.Wrapped: AnyObject, Output: AnyObject { func toRACCommand() -> RACCommand<Input.Wrapped, Output>}extension ActionProtocol where Input: AnyObject, Output: OptionalProtocol, Output.Wrapped: AnyObject { func toRACCommand() -> RACCommand<Input, Output.Wrapped>}extension ActionProtocol where Input: OptionalProtocol, Input.Wrapped: AnyObject, Output: OptionalProtocol, Output.Wrapped: AnyObject { func toRACCommand() -> RACCommand<Input.Wrapped, Output.Wrapped>}
评论