Removing Storyboard From App [Xcode 14, Swift 5]
In this article, I will show you how to create a project without a storyboard in a few steps. Or rather, how to get rid of it, and code the interface programmatically.
Here goes!
- Delete the Main.storyboard file from the project. Click Move to Trash.
2. Remove Storyboard Name from File info.plist:
3. Go to Application Target -> Build Settings -> Find the line: UIKit Main Storyboard File Base Name and remove the name of the storyboard.
4. In order to programmatically set the root controller of our application:
Go to SceneDelegate file and in the func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) method add the following code:
guard let windowScene = (scene as? UIWindowScene) else { return }window = UIWindow(windowScene: windowScene)let viewController = ViewController()
window?.rootViewController = viewController
window?.makeKeyAndVisible()
5. Excellent! You did it! 👯♀️❤️
Thank you for viewing the article.
Subscribe so you don’t miss anything ❤️👨🏻💻My links 🔗:Youtube 🎥: https://bit.ly/3eBDWM1Instagram 🖼: https://bit.ly/3Bb5DCZ