Pad*_*dma 5 macos nstableview reactive-programming rx-swift rx-cocoa
如何使用反应框架使用数组填充NSTableview?在iOS中使用UITableview:
self.viewModel.arrayElements.asObservable()
.observeOn(MainScheduler.instance)
.bind(to: detailsTableView.rx.items(cellIdentifier: "comment", cellType: UITableViewCell.self)){
(row,element,cell) in
cell.addSubview(cellView)
}.addDisposableTo(disposeBag)
Run Code Online (Sandbox Code Playgroud)
我如何为NSTableView实现相同的功能
Mar*_*ist -1
尝试下面的方法,你应该使用驱动程序而不是可观察的
阅读此https://github.com/ReactiveX/RxSwift/blob/master/Documentation/Traits.md
import RxSwift
import RxCocoa
let data = Variable<[String]>([])
let bag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
data.asDriver.drive( tableView.rx.items(cellIdentifier: "idenifier")){(row:Int, comment:String, cell:UITableViewCell) in
cell.title = report
}.disposed(by:bag)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
443 次 |
| 最近记录: |