Set Rootview controller programatically in swift

let VC = storyBoard.instantiateViewController(withIdentifier: "HomeViewController") as! HomeViewController
self.navigationController = UINavigationController(rootViewController: VC)
self.window?.rootViewController = self.navigationController
self.window?.makeKeyAndVisible()