This content originally appeared on DEV Community and was authored by Luiz Gabriel
- 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 🍏
This content originally appeared on DEV Community and was authored by Luiz Gabriel
Print
Share
Comment
Cite
Upload
Translate
Updates
There are no updates yet.
Click the Upload button above to add an update.
APA
MLA
Luiz Gabriel | Sciencx (2024-09-01T21:12:44+00:00) Setup UIKIT Without StoryBoard. Retrieved from https://www.scien.cx/2024/09/01/setup-uikit-without-storyboard/
" » Setup UIKIT Without StoryBoard." Luiz Gabriel | Sciencx - Sunday September 1, 2024, https://www.scien.cx/2024/09/01/setup-uikit-without-storyboard/
HARVARDLuiz Gabriel | Sciencx Sunday September 1, 2024 » Setup UIKIT Without StoryBoard., viewed ,<https://www.scien.cx/2024/09/01/setup-uikit-without-storyboard/>
VANCOUVERLuiz Gabriel | Sciencx - » Setup UIKIT Without StoryBoard. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/01/setup-uikit-without-storyboard/
CHICAGO" » Setup UIKIT Without StoryBoard." Luiz Gabriel | Sciencx - Accessed . https://www.scien.cx/2024/09/01/setup-uikit-without-storyboard/
IEEE" » Setup UIKIT Without StoryBoard." Luiz Gabriel | Sciencx [Online]. Available: https://www.scien.cx/2024/09/01/setup-uikit-without-storyboard/. [Accessed: ]
rf:citation » Setup UIKIT Without StoryBoard | Luiz Gabriel | Sciencx | https://www.scien.cx/2024/09/01/setup-uikit-without-storyboard/ |
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.