美文网首页
RxSwift-双向绑定

RxSwift-双向绑定

作者: Code_人生 | 来源:发表于2019-08-13 17:14 被阅读0次
    • UI响应model
            self.searchBar.rx.text.orEmpty
                .bind(to: self.viewModel.searchTextOB)
                .disposed(by: self.disposeBag)
    
    • model绑定到UI
            self.viewModel.searchData.drive(self.tableView.rx.items){ (tb,indexPath,model) -> LGTableViewCell in
                let cell = tb.dequeueReusableCell(withIdentifier: self.resuseID) as! LGTableViewCell
                cell.nameLabel.text = model.name
                cell.classLabel.text = model.url
                cell.selectionStyle = .none
                return cell
            }.disposed(by: self.disposeBag)
    

    待完善

    相关文章

      网友评论

          本文标题:RxSwift-双向绑定

          本文链接:https://www.haomeiwen.com/subject/vwmbjctx.html