1. info.plist에서 Main 스토리보드에 대한 정보 제거
- Main storyboard file base name 삭제
2. Scene Delegate 파일에서 윈도우 설정해주기
import UIKit class
SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: windowScene.coordinateSpace.bounds)
window?.windowScene = windowScene
window?.rootViewController = ViewController(nibName: nil, bundle: nil) // ✔️ 여기가 루트 뷰컨 설정해주는 부분임
window?.makeKeyAndVisible()
}
- 그 외
- 뷰컨에서 배경 색 설정 따로 해줘야함
- App Delegate에서 해줬을때 뷰컨에서 설정해준 UI 요소들이 안 뜨는데 왜지...?
➡️ iOS 13부터 등장한 Scene Delegate가 App Delegate에서 하던 일의 일부를 담당하게 되었기 때문에 여기서 해주는 거라고 한다!
참고한 곳
[Xcode] storyboard 없이 프로젝트 시작하기
안녕하세요 오늘은 storyboard 없이 ViewController()를 불러오는 방법에 대해 설명하도록 하겠습니다. ViewController()는 프로젝트 생성 시 자동으로 만들어지는 UIViewController입니다. 스토리보드의 장단점
formestory.tistory.com
[iOS13] 스토리보드 없이 프로젝트 시작하기
프로젝트 생성 프로젝트 생성시 User Interface 항목을 Storyboard로 설정하고 생성해줍니다! 스토리보드 파일 삭제하기 스토리보드 파일 없이 빌드하는것이 목표이므로 "Main.storyboard" 파일을 삭제합니
macgongmon.club
'개발 > iOS' 카테고리의 다른 글
[iOS] GCD에 대해 알아보자 (4) | 2022.02.04 |
---|---|
[iOS] Xcode의 시뮬레이터가 매우 느리게 동작할 때 해결법 (1) | 2022.01.30 |
스크롤 안먹힐때 (0) | 2021.11.25 |
[iOS/Swift] 오늘 배운 것 정리 #1 (0) | 2021.11.19 |
swift 문법 기초 7/7 (0) | 2021.09.01 |
댓글