- First you need create a new project
- Delete the file main from your project
- after that we will have to clean some properties where it refers to file main
- click on the symbol ➖ and delete the property Storyboard Name
- Access the main file, go to "build settings" and search about the reference "main"
- delete the value's property
- access the file scene delegate
- inside function "scene", we will add this code above
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
let window = UIWindow(windowScene: windowScene)
let vc = ViewController()
window.rootViewController = vc
window.makeKeyAndVisible()
self.window = window
}
To test if works it, access the viewController add this line inside the method viewDidLoad()
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .yellow
}
}
Just execute and magic happens 🍏