banner



How Yo Remove Moulding Finishing Nails From Baseboard

Whenever y'all start a new project in Xcode, you need to cull between Storyboards and SwiftUI. Conspicuously missing from this list is "None of the above".

For everyone that wants to build their app with programmatic UI, you're left in the dust. If you lot want to start a project with programmatic AutoLayout, one of the first things you must practise is remove Principal.storyboard. Nevertheless, it'due south non quite every bit straightforward as you'd recollect.

Today, let'due south go through the steps for removing the Main.storyboard from our project.

Step 1: Delete Main.storyboard

This is the easy part. Detect Main.storyboard in the project navigator and smash that delete fundamental with all your might. When prompted, select "Move to Trash", and put it where it belongs! 😈

This will remove the file from your project, but references to Main.storyboard will still be. Allow'south go rid of those.

Main.Storyboard in the Project Navigator

Step 2.1: Remove Chief Storyboard File Base Name in your Info.plist

Have you ever wondered how iOS knows which storyboard to instantiate when your app outset launches? Like the rest of your app's metadata, this is contained in the Info.plist file.

Locate the Info.plist in the project navigator, and remove the Primary Storyboard File Base of operations Proper name cardinal.

Info.plist main storyboard key

This indicates to the system that there isn't a default storyboard, and then it won't bother trying to notice one.

Stride 2.2: Remove Main.storyboard from the Scene Manifest in your Info.plist

New in iOS 13, UISceneDelegate and friends have inherited a lot of the work that AppDelegate used to manage. If you created a new projection with iOS thirteen or higher as your target, you'll demand to remove the Storyboard Proper noun key from inside your application scene manifest as well.

Info.plist Scene Manifest Key

Footstep 3: Update your AppDelegate and SceneDelegate

Now that iOS volition no longer try to load your UI from a storyboard, we demand to manually create its UIWindow and assign it a root view controller. For projects targeting iOS xiii and above, you can exercise this in your SceneDelegate, inside scene(willConnectTo: options:) .

                              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                }                let                window                =                UIWindow                (                windowScene                :                windowScene                )                window                .                rootViewController                =                ViewController                ()                self                .                window                =                window                window                .                makeKeyAndVisible                ()                }                }                          

What'south more than, if you're withal supporting iOS 12 or below, you'll need to update your AppDelegate since that's the entry betoken of your app. Here'due south what your application:didFinishLaunchingWithOptions: will look similar.

                              @UIApplicationMain                class                AppDelegate                :                UIResponder                ,                UIApplicationDelegate                {                var                window                :                UIWindow                ?                func                awarding                (                _                awarding                :                UIApplication                ,                didFinishLaunchingWithOptions                launchOptions                :                [                UIApplication                .                LaunchOptionsKey                :                Any                ]?)                ->                Bool                {                window                =                UIWindow                ()                window                ?                .                rootViewController                =                RootViewController                ()                window                ?                .                makeKeyAndVisible                ()                return                true                }                }                          

Both of these snippets reach roughly the same thing. They each instantiate a new UIWindow, they assign a rootViewController, and they make the window key and visible.

Now you're all set!

If yous completed the steps above, you should exist able to run your app without whatsoever unexpected crashes, and with all the fun of building your UI in lawmaking!

Source: https://ioscoachfrank.com/remove-main-storyboard.html

Posted by: bowenmentere.blogspot.com

0 Response to "How Yo Remove Moulding Finishing Nails From Baseboard"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel