As you can see in the picture, there're 3 controllers at the bottom which are (HomeTableViewController, NavigationViewController and NewsViewController)
HomeTableViewController is the Main Page which I'm using the SWRevealViewController and set it as a front page. (sw_front)
After I've selected a row in HomeTableViewController, it can navigate to NewsTableViewController. However, I've added a back button in the NewsViewController to navigate back to the previous page which is HomeTableViewController, I'm not manage to do that with this code.
In the HomeTableViewController navigate to NewsViewController by selected a row
@IBAction func btnBack(sender: AnyObject)
{
let home = HomeTableViewController()
self.presentViewController(home, animated: true, completion: nil)
}
In the NewsViewController press back button back to previous page
@IBAction func btnBack(sender: AnyObject)
{
let home = HomeTableViewController()
self.presentViewController(home, animated: true, completion: nil)
}
If I pressed the back button in the NewsViewController, this error appeared.
fatal error: unexpectedly found nil while unwrapping an Optional value
self.revealViewController().rearViewRevealWidth = 200
This code has an error and is located in the HomeTableViewController. I hope that someone could help me on this. Thank you.