Xcode11 programmatically layout preparation without Storyboard

How to delete Main.storyboard and how to prepare UIKit programmatically layout in Xcode11.

Choose Swift and Storyboard.

Navigation pane → PROJECT-NAME → TARGETS → General → Deployment Info → Main Interface

Expand Info.plistApplication Scene Manifest (expand)→ Scene Configuration (expand) → Application Session Role (expand) → Item 0 (Default Config… (expand). Delete the item “Storyboard Name” .

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {guard let windowScene = (scene as? UIWindowScene) else { return }window = UIWindow(frame: UIScreen.main.bounds)let viewController = ViewController()window?.rootViewController = viewControllerwindow?.makeKeyAndVisible()window?.windowScene = windowScene}

For example,

Add some code in ViewController.swift .

For example:

import UIKitclass ViewController: UIViewController {    override func viewDidLoad() {        super.viewDidLoad()        // Do any additional setup after loading the view.        view.backgroundColor = .cyan    }}

After adding the bellow code, try run this project. If successful, iOS simulator will show up colored background.



iOS Developer, Front-end Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store