Created
February 19, 2017 13:58
-
-
Save srdanrasic/cc23df0b9c924c154903cd902d72a0eb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
extension RecipeList { | |
public func createScene() -> UIViewController { | |
let vc = ViewController.RecipeList() | |
vc.sortDescriptorPickerView.reactive.selectedDescriptor | |
.observe(with: sortDescriptor) | |
.dispose(in: vc.reactive.bag) | |
recipes | |
.bind(to: vc.tableView, createCell: RecipeCell.create) | |
vc.tableView.reactive.didSelectCellAtIndexPath | |
.with(latestFrom: recipes) { recipes, indexPath in recipes[indexPath.row] } | |
.bind(to: vc) { vc, recipe in | |
let recipeDetails = RecipeDetails(client: client, recipe: recipe) | |
let recipeDetailsVC = recipeDetails.createScene() | |
vc.navigationController?.pushViewController(recipeDetailsVC, animated: true) | |
} | |
return vc | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment