I have tried to set root view controller for a navigation controller with viewcontoller name only. But i got only with storyboard id only. Please help me with this
let story = UIStoryboard.init(name: "Main", bundle: nil)
let vc = story.instantiateViewController(withIdentifier: "MyTaskVC")
self.navigationController?.pushViewController(vc, animated: true)
Don't think it is possible but see if the below helps. You will need an identifier "String" to perform a segue/push. Its a segue identifier not a storyboard identifier so be cautious!
//Segue
performSegue(withIdentifier: "Put your segue identifier name here", sender: nil)
If you have a storyboard ID then,
//Push
let storyID = UIStoryboard(name: "your main storyboard name", bundle:nil)
let someview = storyID.instantiateViewController(withIdentifier: "someview_Controller_name") as! someview_Controller_name
navigationController?.pushViewController(someview_Controller_name, animated: true)
Try this,
let story = UIStoryboard(name: "Main", bundle: nil)
let vc = story.instantiateViewController(withIdentifier: "MyTaskVC")
let navController = UINavigationController(rootViewController: vc)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.