Ios “我该如何解决?”;反应性<_&燃气轮机';是含糊不清的;tableView上下文中出现错误
我有一个Ios “我该如何解决?”;反应性<_&燃气轮机';是含糊不清的;tableView上下文中出现错误,ios,swift,uitableview,rx-swift,rx-cocoa,Ios,Swift,Uitableview,Rx Swift,Rx Cocoa,我有一个方法,它返回一个单值: func getEventStatus() throws -> Single<EventModel?> { return try mainService.getEventStatus() } 作为方法抛出的我添加了do{try catch{},但这似乎没有什么区别 我在这里遗漏了什么?问题是您的方法的签名 getEventStatus()方法只发出一个EventModel,甚至是一个可选的 items(cellIdentifier:ce
方法
,它返回一个单值
:
func getEventStatus() throws -> Single<EventModel?> {
return try mainService.getEventStatus()
}
作为方法
抛出的
我添加了do{try catch{}
,但这似乎没有什么区别
我在这里遗漏了什么?问题是您的方法的签名
getEventStatus()
方法只发出一个EventModel
,甚至是一个可选的
items(cellIdentifier:cellType:)
方法需要一个数组。谢谢@Daniel,但我如何将其转换为数组?我试了试了?viewModel.getEventStatus().asObservable().toArray().bind…
但是它说“'PrimitiveSequence'没有成员'bind'”,在EventModel周围放上括号,去掉问号。
viewModel.getEventStatus().asObservable().bind(to: tableView.rx.items(cellIdentifier: EventLogTableViewCell.identifier, cellType: EventLogTableViewCell.self)) { row, data, cell in
cell.viewModel = data
}.disposed(by:disposeBag)