There is this code:
self.window = UIWindow(frame: UIScreen.main.bounds)
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
var exampleViewController: CustomClass1 = mainStoryboard.instantiateViewController(withIdentifier: "custom") as! CustomClass1
self.window?.rootViewController = exampleViewController
self.window?.makeKeyAndVisible()
I want to create a function that has this code inside it, but the problem is I want to pass a class as parameter so that if I pass CustomClass2, the middle line of the code should work like
var exampleViewController: CustomClass2 = mainStoryboard.instantiateViewController(withIdentifier: "custom") as! CustomClass2
the function should be called like this: foo(class: CustomClass3)
How can I write this function?
PS: I'm not sure if this makes difference but all these CustomClasses are Custom ViewControllers.