ReactiveObjCBridge连接 Swift 和 Objective-C API

联合创作 · 2023-09-28

在苹果发布 Swift 语言之后,ReactiveCocoa 使用 Swift 进行了重写。该框架创建了一个桥用来连接 Swift 和 Objective-C API (ReactiveSwiftReactiveObjC)。

示例代码:

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>
}
浏览 5
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报
评论
图片
表情
推荐
点赞
评论
收藏
分享

手机扫一扫分享

编辑
举报