0

I have discover that the pushFrontViewController function in SWReveal.

I have added the UIViewController in the storyboard's Contact.enter image description here And I am trying covert to swift, but it do not work. Here is the code:

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
     //CODE TO BE RUN ON CELL TOUCH
        var newFrontController: UIViewController
        let selectedItemMenu = arrayOfSlider[indexPath.row]

        var revealController  = SWRevealViewController()
        var contact_nav = ContactViewController()
        newFrontController = UINavigationController(rootViewController:contact_nav) 
        revealController.pushFrontViewController(newFrontController , animated:true)
}

Is there anything that I am wrong?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jacky Shek
  • 953
  • 1
  • 11
  • 35

2 Answers2

0

SWRevealViewControllor is not that much hard. you should follow this example. I think its a perfect example you can try. It may help you !

iRiziya
  • 3,235
  • 1
  • 22
  • 36
  • Thank you very much for your helping, but I think that it is not suitable for me. The reason is that the user can edit the menu bar from the DB which means that I need to do it dynamically. After this 2 months, I have depth research on SWReveal that there is a simple code to do it `self.revealViewController().setFrontViewController(viewController, animated: true)`. Anyway, thank you for your example. – Jacky Shek May 16 '15 at 10:28
-1

After having a depth research, I just need some simple code to solve this case which is at the below:

            self.revealViewController().revealToggleAnimated(true)
            let vc = storyboard!.instantiateViewControllerWithIdentifier(viewControllerStoryBoardID[indexPath.row]) as! UIViewController
            self.revealViewController().setFrontViewController(vc, animated: true)
Jacky Shek
  • 953
  • 1
  • 11
  • 35