RxASDiff 1.0.0

RxASDiff 1.0.0

Geektree0101 维护。



 
依赖
Texture= 2.6
RxSwift~> 4.0
RxCocoa~> 4.0
DeepDiff~> 1.2
 

RxASDiff 1.0.0

  • Geektree0101

RxASDiff

CI Status Version License Platform

替代文本 RxASDiff 是基于 DeepDiff(ref: https://github.com/onmyway133/DeepDiff) 的 Texture Reactive Diff Library

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

创建差异输出

let relay = BehaviorRelay<[HashableObject]>(value: [])
// Behavior or Publich or etc all Observer available

DiffObserver<HashableObject>.rxDiff(relay.asObservable()).subscribe( ... ).disposed(by: ...)
// output: Array<Change<HashableObject>> ref: https://github.com/onmyway133/DeepDiff

将差异转换为 indexPaths 对象

let relay = BehaviorRelay<[HashableObject]>(value: [])
// Behavior or Publich or etc all Observer available

DiffObserver<HashableObject>.rxDiff(relay.asObservable(), section: Int).subscribe().disposed()
// output: ChangeWithIndexPath ref: https://github.com/onmyway133/DeepDiff

便捷地将差异输出应用于 tableNode 或 collectionNode

    func case1() {
        DiffObserver<TestModel>
            .rxDiff(relay.asObservable(), section: 1)
            .subscribe(onNext: { iter in
                self.tableNode.applyDiff(iter, completion: nil)
            }).disposed(by: bag)
    }
    
    func case2() {
        let diffObserver = DiffObserver<TestModel>.rxDiff(relay.asObservable())
        tableNode.rx
            .applyDiff(diffObserver, section: 1, completion: nil)
            .disposed(by: bag)
    }

需求

  • Xcode <~ 9.3
  • Swift <~ 4.1
  • iOS <~ 9.3

安装

RxASDiff 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中

pod 'RxASDiff'

作者

Geektree0101,[email protected]

许可证

RxASDiff 在 MIT 许可证下可用。更多信息请参阅 LICENSE 文件。