Edit
I mistakenly selected "Multiplatform" instead of "iOS" when creating the project.
Simply select "iOS" to create the project and things will be done the traditional way.
I want to start a new project in Xcode 14.2 with just AppDelegate and UIKit, without SwiftUI or SceneDelegate. The method up to Xcode 13 does not seem to work.
1. Create new project in Xcode 14.2
2. Add AppDelegate.swift
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window!.rootViewController = MyViewController()
window!.makeKeyAndVisible()
return true
}
}
3. Add MyViewController.swift
import UIKit
class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemGreen
print("viewDidLoad() called.")
print("frame:", view!.frame)
}
}
When the application is launched, a green screen is expected to appear, but a black screen is displayed.
Print statements are output correctly.
At this time, the following warning appears.
Adding UIApplicationSceneManifest
key to Info.plist
will remove this warning, but the black screen will remain. (Previously, this key was not needed for apps that did not use multiple windows.)
[SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")
What simple something am I missing?