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

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift