If you prefer to work with code ungrammatically 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 follow Swift 2 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: [NSObject: AnyObject]?) -> Bool {

        window = UIWindow(frame: UIScreen.mainScreen().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.

Remove storyboard from iOS or tvOS and design programatically
Translate »