I'm trying to get the blue screen view of my storyboard, but I'm entirely new to this. I don't understand how to navigate through the classes to get to "the blue screen," and it gives me errors.
The original idea is to propagate the variable "managedObjectContext"(CoreData) through this function in the SceneDelegate.
The error I get is: Initializer for conditional binding must have Optional type, not '[UIViewController]'
This is my SceneDelegate Error
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
//guard let _ = (scene as? UIWindowScene) else { return }
let mainViewController = window!.rootViewController as! UINavigationController
if let navViewControllers = mainViewController.viewControllers { //error Initializer for conditional binding must have Optional type, not '[UIViewController]'
let controller = navViewControllers.first as! EditViewController
controller.managedObjectContext = managedObjectContext
}
listenForFatalCoreDataNotifications()
return
}