How do I go about passing a Type as a variable in Swift 4?
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "MapViewController") as! MapViewController
I have something similar to the above in a horrible if statement I'd like to move to a function, but not sure how I pass 'MapViewController' (or whatever the controller is as a variable).
'"Pseduo" Code'
function setVC(withViewController : Any) {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "MapViewController") as! withViewController
}