【发布时间】:2020-06-05 10:03:03
【问题描述】:
我有一个method,它返回一个Single:
func getEventStatus() throws -> Single<EventModel?> {
return try mainService.getEventStatus()
}
我尝试将bind 转换为tableView,但得到error 说它不适用于Singles,所以我尝试添加.asObservable(),但现在我得到了error
表达式类型 'Reactive<_>' 在没有更多上下文的情况下是模棱两可的
我试图查找它的含义,但似乎与 error 的含义没有任何一致性,或者我似乎无法将其应用于我的案例。这就是bind 的样子:
viewModel.getEventStatus().asObservable().bind(to: tableView.rx.items(cellIdentifier: EventLogTableViewCell.identifier, cellType: EventLogTableViewCell.self)) { row, data, cell in
cell.viewModel = data
}.disposed(by:disposeBag)
作为methodthrows,我添加了do { try catch{} },但这似乎没有什么区别。
我在这里错过了什么?
【问题讨论】:
标签: ios swift uitableview rx-swift rx-cocoa