ARTICLES

Remove storyboard from iOS or tvOS and design programmatically

If you prefer to work with code programmatically instead of via Storyboards then this tutorial will help you start a brand new iOS or tvOS project by removing the default main storyboard.

 

From Xcode, select File…New…Project.  (iOS/tvOS)…Application…Single View Application…Next.

Give your project a title.  Select the appropriate checkmarks for Core Data and testing.  Press Next.

Delete Main.storyboard and select Move to Trash.

Select the project from the Project Navigator. Select the Target.  Under General…Deployment Info…Main Interface, delete “Main”.

Go to AppDelegate and add the following Swift 3 code if you want a tab view controller with two view controllers.

You should also delete or rename the existing ViewController file.

var tabBarController: UITabBarController!

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        window = UIWindow(frame: UIScreen.main.bounds)
        if let window = window {
            self.tabBarController = UITabBarController()

            let customViewController1 = CustomViewController1()
            let customViewController2 = CustomViewController2()

            self.tabBarController.viewControllers = [customViewController1, customViewController2]
            window.rootViewController = self.tabBarController
            window.makeKeyAndVisible()
        }
        return true
    }

 

 

Did you find this post helpful? Support independent development and improve your sleep by downloading White Noise and Deep Sleep Sounds free from the App Store.



Our Products

Kitemetrics
Keyword level attribution for Apple Search Ads. Optimize your bids and increase your revenue. Sign up for free at kitemetrics.com.

White Noise and Deep Sleep Sounds
Calming and relaxing sounds that will help you sleep like a baby tonight.
Download for free from the App Store.
Get it on Google Play.




Our Sponsors

Get Sleepy
Get Sleepy
The free podcast that puts you to sleep with meditative bedtime stories. Listen at getsleepy.com.