TabBar example iOS swift

Solution:

Drag and drop the tabbarviewController to storyboard and add 2 viewControllers to that then proceed with the below code in appdelegate

Code:

import UIKit


@UIApplicationMain

class AppDelegate: UIResponder, UIApplicationDelegate {


    var window: UIWindow?


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

        // Override point for customization after application launch.

        

        let tabBarController = window?.rootViewController as! UITabBarController

        tabBarController.selectedIndex = 0

        

        return true

    }


}

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

store cgpoint in userdefaults iOS swift