jjzjj

withLatestFrom

全部标签

swift - 带有 resultSelector 的 RxSwift withLatestFrom 无法编译

我有一个Driver类型Bool和一个BehaviorRelay类型Page(这是一个自定义枚举)。enumPage{caseoption1(CustomClass1,CustomClass2)caseoption2(CustomClass3)caseoption3(CustomClass4)varproperty1:CustomClass2?{switchself{case.option1(_,letcustom):returncustomcase.option2,.option3:returnnil}}}我有Driver在另一个ViewModel中。classViewModel1{

swift - RxSwift - withLatestFrom 结合来自两个可观察值的值

我想达到这样的结果:L-1-2-3------4------5-6-7-8----R---------A------B----------C--O---------A3-----B4---------C8所以基本上类似于withLatestFrom但结合了来自两个可观察值的值(如结合最新)。我想没有现成的运算符(operator)。知道如何实现这一点吗? 最佳答案 只需使用您的withLatestFrom生成的选择器。没有闭包的重载实现简单地忽略了第一个可观察对象。例如:Observable.just("one").withLate