You can use instantiateViewControllerWithIdentifier
to instantiate multiple instances of the same view controller programmatically from a Storyboard. Each time you call this method, you get a new instance of the view controller.
So, for example, if you have a “WebViewController” defined in your Storyboard, you could do the following:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc1 = storyboard.instantiateViewControllerWithIdentifier("WebViewController")
let vc2 = storyboard.instantiateViewControllerWithIdentifier("WebViewController")
And vc1
and vc2
will be two totally different instances of the same view controller. So you could, for example, load one URL in the first web view controller and another URL in the second.
This is all in the docs, of course, but sometimes it’s easy to miss.