Skip to content
Auto update to data for UITableView/UICollectionView
Branch: master
Clone or download
Latest commit 9e43c47 Jul 6, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Images Add image Jul 5, 2016
RxAutoUpdater-Sample
Sources
.gitignore
.travis.yml
LICENSE Initial commit May 24, 2016
README.md
RxAutoUpdater.podspec

README.md

RxAutoUpdater

Version License Platform Build Status

Auto update to data for UITableView/UICollectionView

⚠️ RxAutoUpdater can't respond to the cells in various shapes or multiple section yet. See ToDo.

Preview

$ pod try RxAutoUpdater

Example In Action
var items: TableItem = ["Lee Sun-Hyoup",
                        "kciter",
                        "RxSwift",
                        "Reactive"]

tableView.rx_autoUpdate(items, animationTypes: animationTypes, identifier: "Cell") { index, cell, item in cell.textLabel?.text = item }.addDisposableTo(disposeBag)

addButton.rx_tap .subscribeNext { self.items.append("Appended") }.addDisposableTo(disposeBag)

removeButton.rx_tap .subscribeNext { self.items.removeLast() }.addDisposableTo(disposeBag)

tableView.rx_itemSelected .subscribeNext { indexPath in self.items[indexPath.row] = "Changed!" }.addDisposableTo(disposeBag)

Requirements

  • iOS 7.0+
  • Swift 2.2
  • Xcode 7

Installation

  • CocoaPods

    use_frameworks!
    pod "RxAutoUpdater"
  • Manually

    • To install manually the RxAutoUpdator in an app, just drag the Sources/*.swift file into your project.

Simple Usage

UITableView

var items: TableItem<String> = ["Item1", "Item2", "Item3"]
tableView.rx_autoUpdate(items, identifier: "Cell") { index, cell, item in
    cell.textLabel?.text = item
}.addDisposableTo(disposeBag)
  • Change animation type
let animationTypes = RxTableViewAnimationType(insertAnimation: .Left, 
                                              deleteAnimation: .Right, 
                                              reloadAnimation: .None)
tableView.rx_autoUpdate(items, 
                        animationTypes: animationTypes, 
                        identifier: "Cell") { index, cell, item in
    cell.textLabel?.text = item
}.addDisposableTo(disposeBag)

UICollectionView

var items: CollectionItem<UIColor> = [UIColor.blackColor(),
                                      UIColor.yellowColor(),
                                      UIColor.redColor(),
                                      UIColor.greenColor(),
                                      UIColor.brownColor()]

collectionView.rx_autoUpdate(items, identifier: "Cell") { index, cell, item in
    cell.backgroundColor = item
}.addDisposableTo(disposeBag)

ToDo

  • Multiple Section
  • DataSource Customize

License

The MIT License (MIT)

Copyright (c) 2016 Lee Sun-Hyoup

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.