Skip to content

HoloFoundation/HoloCollectionViewDiffPlugin

Repository files navigation

HoloCollectionViewDiffPlugin

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

What's for

HoloCollectionViewDiffPlugin is a plugin for HoloCollectionView framework, which provide the diff reload actions support for DeepDiff.

To use it, simply make sure you use DeepDiff and import this plugin.

Usage

let collectionView = UICollectionView.init(frame: self.view.bounds, collectionViewLayout: flowLayout)
self.view.addSubview(collectionView)

collectionView.holo_makeItems { (make) in
    for item in [Int]() {
        _ = make.item(CollectionViewCell.self).model(item).diffId(item)
    }
}
collectionView.reloadData()

// diff reload
collectionView.stored()

collectionView.holo_removeAllSections()
collectionView.holo_makeItems { (make) in
    for item in [Int]() {
        _ = make.item(CollectionViewCell.self).model(item).diffId(item)
    }
}

collectionView.reload()

If the collectionView has been reload and then you want to diff reload, you need to perform collectionView.stored() before collectionView.holo_makeItems{}.

Installation

HoloCollectionViewDiffPlugin is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'HoloCollectionViewDiffPlugin'

Author

gonghonglou, gonghonglou@icloud.com

License

HoloCollectionViewDiffPlugin is available under the MIT license. See the LICENSE file for more info.

About

A HoloCollectionView plugin to support diff reload using DeepDiff.

Resources

License

Stars

Watchers

Forks

Packages

No packages published