[iOS swift] Scenedelegate 에서 시작화면 지정하는 코드
Case 1. navigation을 달고 있는 HomeViewController에서 시작하는 앱
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let scene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: scene)
let viewController = HomeViewController()
let navigationController = UINavigationController(rootViewController: viewController)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
}
Case 2. TabbarViewController에서 시작하는 앱
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let scene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: scene)
window?.rootViewController = TabbarViewController()
window?.makeKeyAndVisible()
}
'iOS > iOS SeSAC 2기 TIL' 카테고리의 다른 글
앱 런칭 계획 (0) | 2022.08.30 |
---|---|
iOS swift 과제중 알게된부분 realm관련 (0) | 2022.08.28 |
iOS swift 백업/복구 (0) | 2022.08.25 |
iOS swift ActivityViewController (0) | 2022.08.25 |
[iOS swift] 값 전달시 유의사항: 화면 전환 전에 값 전달 (0) | 2022.08.23 |