Reputation: 287
I use this code to jump between two storyboard and it's success.
var sb = UIStoryboard(name: “storyboardbName”, bundle: nil)
var viewctrl = sb.instantiateViewControllerWithIdentifier(“a-view”) as! UIViewController
self.navigationController?.pushViewController(viewctrl, animated: true)
But how can i pass value to the other storyboard? When i use only one storyboard before,i can set segue to pass value but use to storyboard,there is no segue can set.
Upvotes: 0
Views: 952
Reputation: 2324
For example, in view controller of second storyboard there is a line var someString = ""
Create another variable of the same type in view controller of first stroryboard (from you're executing code you've posted), like aSomeString = ""
Set value to aSomeString
before line self.navigationController?.pushViewController(viewctrl, animated: true)
and then set value to variable from destination VC: viewctrl.someString = aSomeString
Look this question, I had the same problem
Upvotes: 1