// iOS13以降 if #available(iOS 13.0, *) { let sceneDelegate = UIApplication.shared.connectedScenes .first!.delegate as! SceneDelegate sceneDelegate.window!.rootViewController = /* ViewController Instance */ // iOS12以前 } else { // UIApplication.shared.keyWindow?.rootViewController let appDelegate = UIApplication.shared.delegate as! AppDelegate appDelegate.window!.rootViewController = /* ViewControlle