Skip to content

Instantly share code, notes, and snippets.

@charlag
Last active August 20, 2016 15:51
Show Gist options
  • Save charlag/83aac2cb1d18e83ecf55555fd8062be0 to your computer and use it in GitHub Desktop.
Save charlag/83aac2cb1d18e83ecf55555fd8062be0 to your computer and use it in GitHub Desktop.
class ViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
let disposeBag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
tableView.estimatedRowHeight = 44
tableView.rowHeight = UITableViewAutomaticDimension
let dataSource = RxTableViewSectionedAnimatedDataSource<AuthSection>()
dataSource.configureCell = { _, tableView, indexPath, item in
let cell = tableView.dequeueReusableCellWithIdentifier(item.rawValue, forIndexPath: indexPath)
return cell
}
Observable<[AuthCellType]>.just([
.Headline,
.Separator,
.EmailTextField,
.PasswordTextField,
.LoginButton
])
.map { [AuthSection(model: 0, items: $0)] }
.bindTo(tableView.rx_itemsWithDataSource(dataSource))
.addDisposableTo(disposeBag)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment