Last active
August 20, 2016 15:51
-
-
Save charlag/83aac2cb1d18e83ecf55555fd8062be0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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