Last active
April 16, 2025 21:29
-
-
Save Myrrel/503f52edc4ffda27786d4a41b3d6a0bb to your computer and use it in GitHub Desktop.
Removing Storyboard From App [Xcode 14, Swift 5]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. 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: | |
import UIKit | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? | |
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |
guard let windowScene = (scene as? UIWindowScene) else { return } | |
window = UIWindow(windowScene: windowScene) | |
let viewController = ViewController() | |
let navigation = UINavigationController(rootViewController: viewController) | |
window?.rootViewController = navigation | |
window?.makeKeyAndVisible() | |
} | |
func sceneDidDisconnect(_ scene: UIScene) { | |
} | |
func sceneDidBecomeActive(_ scene: UIScene) { | |
} | |
func sceneWillResignActive(_ scene: UIScene) { | |
} | |
func sceneWillEnterForeground(_ scene: UIScene) { | |
} | |
func sceneDidEnterBackground(_ scene: UIScene) { | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment