iOS 13: Swift - 'Set application root view controller programmatically' does not work

后端 未结 14 1106
北恋
北恋 2020-12-01 01:43

I have following code in my AppDelegate.swift to setup root view controller for an iOS application. But it does not work. It follows Target structure (defined under General

14条回答
  •  不知归路
    2020-12-01 02:21

    let controller = ....
    let keyWindow = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
    keyWindow?.rootViewController = controller
    keyWindow?.makeKeyAndVisible()
    

    These are the basic code required to set root view controller.

提交回复
热议问题