🔨Xcode Project Setup
Fall 2023 | Vin Bui
Create a New Project
Go to File > New > Project
Select the iOS tab, choose App and click Next
You can leave everything alone except for the following:
Product Name: Enter the name of the app
Interface: Storyboard (yes, keep Storyboard even though we won’t be using it)
Language: Swift
Uncheck “Use Core Data”
Uncheck “Include Tests”

Choose a directory for your project and hit Create
Switch to Programmatic Layout
To utilize programmatic Auto Layout, delete
Main.storyboard
from the Navigator in Xcode. Right click > Delete > Move to Trash


Press
CMD + SHIFT + F
or click on the 🔎 icon in the Navigator. Look upstoryboard
and you should see something like this:

Click on the red box above and look up
storyboard
in the filter search bar. SelectUIKit Main Storyboard File Base Name
and his Backspace on your keyboard to delete it.

Now select the blue box from step 2, or go to
Info.plist
and deleteStoryboard Name
by clicking on the minus (-) symbol.

Setup SceneDelegate.swift
SceneDelegate.swift
Add the following code to the function scene
in SceneDelegate.swift
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// 1. Capture the scene
guard let windowScene = (scene as? UIWindowScene) else { return }
// 2. Create a new UIWindow and pass in a UIWindowScene
let window = UIWindow(windowScene: windowScene)
// 3. Create a view hierarchy programmatically
let rootVC = ViewController()
let navController = UINavigationController(rootViewController: rootVC)
// 4. Set the navigation controller as the window's root view controller
window.rootViewController = navController
// 5. Set the window and call makeKeyAndVisible()
self.window = window
window.makeKeyAndVisible()
}
Last updated
Was this helpful?