Without a storyboard is easy - just initialize the view controller and be sure to load the view:
let viewController = ViewController()
viewController.loadViewControllerForUnitTest()
// expectations
With a storyboard, you just need to assign the view controller a Storyboard ID in the .storyboard file and load the storyboard first and then instantiate the VC from that storyboard:
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let viewController = storyboard.instantiateViewController(withIdentifier: "ViewController") as! ViewController
// expectations
Without a storyboard is easy - just initialize the view controller and be sure to load the view:
With a storyboard, you just need to assign the view controller a Storyboard ID in the
.storyboard
file and load the storyboard first and then instantiate the VC from that storyboard: