ReactiveObjCBridge連接 Swift 和 Objective-C API
在蘋果發(fā)布 Swift 語言之后,ReactiveCocoa 使用 Swift 進(jìn)行了重寫。該框架創(chuàng)建了一個(gè)橋用來連接 Swift 和 Objective-C API (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>
}評(píng)論
圖片
表情
