RxASDiff
RxASDiff is Texture Reactive Diff Library built on DeepDiff(ref: https://github.com/onmyway133/DeepDiff)
Example
To run the example project, clone the repo, and run pod install
from the Example directory first.
create diff output
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
convert diff to indexPaths object
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
convenience apply diff output onto tableNode or 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)
}
Requirements
- Xcode <~ 9.3
- Swift <~ 4.1
- iOS <~ 9.3
Installation
RxASDiff is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'RxASDiff'
Author
Geektree0101, [email protected]
License
RxASDiff is available under the MIT license. See the LICENSE file for more info.