Ok, I have been following along with a tutorial and I have completed that, all works fine. However the initial view that loads is a UITableViewController and I would like a UIViewController.
Here is the code for that:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
window?.makeKeyAndVisible()
window?.rootViewController = UINavigationController(rootViewController: ViewController())
return true
}
I have tried editing this line:
UINavigationController(rootViewController: ViewController())
to:
window?.rootViewController = UIViewController(rootViewController: ViewController())
But then I am given this error:
Incorrect argument label in call (have 'rootViewController:', expected 'coder:')
It then asks me to 'Fix-it' so I do, which changes the line to:
window?.rootViewController = UIViewController(coder: ViewController())
But then this now throws the error:
Cannot convert value of type 'ViewController' to expected argument type 'NSCoder'
I have also tried:
window?.rootViewController = ViewController()
but with that, the simulator goes black.
Clarify Question:
How do I get the first View that loads in my app to be of type UIViewController?