Learn RxSwift--4.for UITableview
2017-08-01 本文已影响0人
金克拉拉拉拉
for UITableview
利用mvvm 在viewmodel中构建Obserable 其继承于Variable 类型为[heroModel] 本质上扔为一个dataArray
![](https://img.haomeiwen.com/i6268972/0c71b36e1a5d5dbb.png)
其中 model为
![](https://img.haomeiwen.com/i6268972/845ccf60df06cd8b.png)
而在controller层中 利用rxswift cocoa 对tableview的扩展直接 将viewModel 中Obserable bind to tableview 事件为items
![](https://img.haomeiwen.com/i6268972/64ee744b58251115.png)
若需要数据源发生更改
![](https://img.haomeiwen.com/i6268972/3bd9ad1277fe8f9c.png)
tableview 选择事件监听
![](https://img.haomeiwen.com/i6268972/b1ec6dd8e6d33c52.png)