Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 7 issue with Xcode 11.1 #36

Open
weters opened this issue Nov 23, 2019 · 1 comment
Open

Project 7 issue with Xcode 11.1 #36

weters opened this issue Nov 23, 2019 · 1 comment

Comments

@weters
Copy link

weters commented Nov 23, 2019

The following code does not work in new project created in Xcode 11.1 due to the changes to SceneKit.

if let tabBarController = window?.rootViewController as? UITabBarController {
    let storyboard = UIStoryboard(name: "Main", bundle: nil)
    let vc = storyboard.instantiateViewController(withIdentifier: "NavController")
    vc.tabBarItem = UITabBarItem(tabBarSystemItem: .topRated, tag: 1)
    tabBarController.viewControllers?.append(vc)
}

I was able to get it working by doing the following in a new project:

  1. Delete SceneDelegate.swift
  2. Delete Application Scene Manifest in Info.plist
  3. In AppDelegate.swift, do the following:
    1. Add var window: UIWindow?
    2. Delete application(_ :, configurationForConnecting:, options:) and application(_:, sceneSessions:)
@jonniedarko
Copy link

The other option is to add it to SceneDelegate instead
I updated the willConnectTo method from:

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let _ = (scene as? UIWindowScene) else { return }
    }

to :

    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        guard let _ = (scene as? UIWindowScene) else { return }
        if let tabbedBarController = window?.rootViewController as? UITabBarController {
            let storyboard = UIStoryboard(name:"Main", bundle: nil)
            let vc = storyboard.instantiateViewController(withIdentifier: "NavController")
            vc.tabBarItem = UITabBarItem(tabBarSystemItem: .topRated, tag: 1)
            tabbedBarController.viewControllers?.append(vc)
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants