Skip to content

Instantly share code, notes, and snippets.

@koogawa
Created May 15, 2016 03:32
Show Gist options
  • Save koogawa/169a8399a4da5e2675759162ca3d922d to your computer and use it in GitHub Desktop.
Save koogawa/169a8399a4da5e2675759162ca3d922d to your computer and use it in GitHub Desktop.
ベニューを取ってきてTableViewに表示するだけなら30行ぐらいで実装できそう #4sqdevjp #CodePiece
import UIKit
import RxSwift
import RxCocoa
class ViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var viewModel = ViewModel()
var dataSource = DataSource()
var delegate = Delegate()
let disposeBag = DisposeBag()
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.delegate = self.delegate
self.viewModel.firstRequest()
self.viewModel.venues
.asDriver()
.drive (
self.tableView.rx_itemsWithDataSource(self.dataSource)
)
.addDisposableTo(self.disposeBag)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment