Document
https://developer.apple.com/documentation/coredata/setting_up_a_core_data_stack
Version
> xcodebuild -version
Xcode 13.1
Build version 13A1030d
Issue
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// ERROR: Cannot find 'window' in scope
if let rootVC = window?.rootViewController as? ViewController {
rootVC.container = persistentContainer
}
return true
}
}
Error message: "Cannot find 'window' in scope" I get this error and can't build. What should I do?
Should I create the window myself?