RxASDataSources
RxDataSources for AsyncDisplayKit/Texture: ASTableNode & ASCollectionNode.
特性
- O(N) 从RxDataSources/Differentiator获得的Diff算法
- 共享RxDataSources的API,所以您只需学习一次。
- 支持
ASTableNode
和ASCollectionNode
- 支持
nodeBlock
- 更复杂的应用程序示例
需求
- iOS 9.0+
- Xcode 10.1+
- RxSwift 5.0 & Texture 2.8
安装
CocoaPods
要使用 CocoaPods 将 RxASDataSources 集成到您的 Xcode 项目中,请在您的 Podfile
中指定它
pod 'RxASDataSources'
然后运行以下命令
$ pod install
Carthage
要使用 Carthage 将 RxASDataSources 集成到您的 Xcode 项目中,请在您的 Cartfile
中指定它
github "RxSwiftCommunity/RxASDataSources"
使用方法
如果您熟悉 RxDataSources,使用 RxASDataSources 将会非常简单
typealias Section = SectionModel<String, Int>
let configureCell: ASTableSectionedDataSource<Section>.ConfigureCell = { (dataSource, tableNode, index, model) in
let cell = ASTextCellNode()
cell.text = model.info
return cell
}
let animation = RowAnimation(insertAnimation: .automatic, reloadAnimation: .fade, deleteAnimation: .automatic)
let dataSource = RxASTableSectionedReloadDataSource<Section>(animationConfiguration: animation, configureCell: configureCell)
items
.bind(to: tableNode.rx.items(dataSource: dataSource))
.disposed(by: disposeBag)
对于更高级的使用方法,请参考 RxDataSources 和 示例,然后简单地替换您的 Views -> Nodes。
许可证
RxASDataSources 采用 MIT 许可证发布。有关详细信息,请参阅 LICENSE。