master
 1class SearchController < UIViewController
 2  def viewDidLoad
 3    super
 4    self.view.backgroundColor = UIColor.whiteColor
 5    self.title = "Latest Reviews"
 6    self.navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithTitle("Share", style: UIBarButtonItemStyleBordered, target: self, action: 'push')
 7  end
 8
 9  def push
10    controller = @controller_factory.create(RestaurantController)
11    self.navigationController.pushViewController(controller, animated: true)
12  end
13
14  def bind_to(controller_factory)
15    @controller_factory = controller_factory
16  end
17end
18
19class ControllerFactory
20  def create(controller)
21    instance = controller.alloc
22    instance.bind_to(self)
23    instance.initWithNibName(nil, bundle: nil)
24  end
25end