I am new to ios with swift and swrevealviewcontroller. i faceing a problem! in my slide menu (scene TableViewController Two blue line draw) each row when selected then should be open particuler scene
(View controller) but unfortunatly it is not open . there have no error and didselectRowAt
fire when i select row from the table but pushViewController not working .
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let dvcStoryBordId = menuViewIds[(indexPath.row - 1 )]
let viewController = storyboard?.instantiateViewController(withIdentifier: dvcStoryBordId )
self.navigationController?.pushViewController(viewController!, animated: true)
}
Story Board
do i miss anything ? is it correct way ? self.
UPDATE :
self.navigationController
is nil
. is there any alternative ? or without navigation
Update:
Storyboard Id
menuViewIds = ["shareWithFriends","deliveryTracking", "controls", "support","myAccount"]
Run time view
Try this:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let dvcStoryBordId = menuViewIds[(indexPath.row - 1 )]
let viewController = storyboard?.instantiateViewController(withIdentifier: dvcStoryBordId )
var navigationController = UIApplication.sharedApplication().keyWindow?.rootViewController as! UINavigationController
navigationController?.pushViewController(viewController!, animated: true)
}