Ios 如何在标签栏应用程序中从应用程序委托跳过登录屏幕

Ios 如何在标签栏应用程序中从应用程序委托跳过登录屏幕,ios,swift,redirect,Ios,Swift,Redirect,我试图在关闭应用程序并重新启动时跳过登录屏幕 我回答了很多问题,但没有一个是关于标签条应用程序的。 因此,挑战在于我有许多根视图控制器,如果试图直接使用SecondViewController分配根,它们会分散我整个项目的注意力 下面是我的项目的图片: 是选项卡式酒吧应用程序吗 导航到索引0选项卡栏 登录屏幕 个人资料页 我想跳过登录屏幕并直接显示个人资料页面,因为我的: if UserDefaults.standard.object(forKey: "USER_KEY_UID") != ni

我试图在关闭应用程序并重新启动时跳过登录屏幕

我回答了很多问题,但没有一个是关于标签条应用程序的。 因此,挑战在于我有许多根视图控制器,如果试图直接使用SecondViewController分配根,它们会分散我整个项目的注意力

下面是我的项目的图片:

  • 是选项卡式酒吧应用程序吗
  • 导航到索引0选项卡栏
  • 登录屏幕
  • 个人资料页
  • 我想跳过登录屏幕并直接显示个人资料页面,因为我的:

    if UserDefaults.standard.object(forKey: "USER_KEY_UID") != nil {
        /*provide me the correct code can be applied here with out distracting the tabbed bar in the bottom  */
    }
    

    注意:我在appDelegete中应用的上述代码为选项卡栏控制器创建了一个类。它应该是UITabBarController的子类

    将其视为主视图控制器,并在应用程序代理中添加如下所示的登录控制器

    if UserDefaults.standard.object(forKey: "USER_KEY_UID") != nil {
            let storyboard = UIStoryboard(name: [Main Stroyboard] , bundle: nil)
            let mainVcIntial = storyboard.instantiateViewController(withIdentifier: [Main VC])
            let mainController = UINavigationController(rootViewController: mainVcIntial)
            window.rootViewController = mainController
    }else{
           let storyboard = UIStoryboard(name: [loginStoryboard] , bundle: nil)
            let mainVcIntial = storyboard.instantiateViewController(withIdentifier: [Login VC])
            let mainController = UINavigationController(rootViewController: mainVcIntial)
            window.rootViewController = mainController
    }
    window.makeKeyAndVisible()
    
    我认为这将有助于: