Programmatically switching views swift Programmatically switching views swift xcode xcode

Programmatically switching views swift


I just figured it out. I had to make

let vc = self.storyboard.instantiateViewControllerWithIdentifier("billInfo")` 

to be

let vc : AnyObject! = self.storyboard.instantiateViewControllerWithIdentifier("billInfo")

to silence a warning. I then changed presentViewController to showViewController, and it worked. Here is my completed class:

class RestaurantTableViewController: UITableViewController{    override func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!)    {        let row = indexPath?.row        println(row)        let vc : AnyObject! = self.storyboard.instantiateViewControllerWithIdentifier("billInfo")        self.showViewController(vc as UIViewController, sender: vc)    }}


let vc = self.storyboard.instantiateViewControllerWithIdentifier("billInfo") as! BillInfoViewControllerself.presentViewController(vc, animated: true, completion: nil)

LE: downcast added