ios - RxSwift - 如何具有可读的 mergeLatest 事件元素变量名称?

标签 ios swift rx-swift

var isCurrentlySearchingAddress = Variable<Bool>(false)
var currentSelectedPlace = Variable<GeocodePlace?>(nil)

当我订阅时

Observable.combineLatest(viewModel.isCurrentlySearchingAddress.asObservable(), viewModel.currentSelectedPlace.asObservable())

如何使用可读的变量名称来代替 01

enter image description here

最佳答案

你可以这样做:

    Observable.combineLatest(
        varA.asObservable(), varB.asObservable(),
        resultSelector: { value1, value2 in
            print("\(value1) \(value2)")
    }).observeOn(MainScheduler.instance)
        .subscribe()
        .disposed(by: disposeBag)

关于ios - RxSwift - 如何具有可读的 mergeLatest 事件元素变量名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54288554/

相关文章:

ios - 从 json 的字典中解析字典

ios - 使用分页时,iOS TableView 应包含多少行?

ios - 如何在选择器 View 条目旁边添加图像?

ios - RxAlamofire 取消网络请求

ios - UITableViewCell 通过滑动而不是通过点击选择

swift - 如何检查 rxswift 中的 Observable 计数?

ios - 在 quickblox 上上传个人资料图片时 Swift 出错

ios - Google Analytics iOS 事件跟踪开发测试

iOS xcode 按钮未链接。

ios - 入职顺序的最佳模式(逻辑)是什么?