스토리보드 없이 코드 베이스로 UI를 구현하게 된다면 어떻게 세팅할지 알아보자 !
1. main.storyboard 삭제
move to trash 해줘야함 !
2. 프로젝트 설정 - Build Settings - main 검색하면 나오는 UIKit Main storyboard File Base Name 백스페이스로 제거
3. 파일 중 Info.plist에서 해당 항목도 백스페이스로 제거
4. SceneDelegate 내에 코드 수정
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
window?.backgroundColor = .systemBackground
window?.rootViewController = ViewController()
window?.makeKeyAndVisible()
}
루트 뷰 컨트롤러는 상황에 맞춰 따로 설정해주면 된다.
5. 개발 시작
사실 SceneDelegate에서도 설정해주는 방식도 있지만 기억상 SceneDelegate를 지우고 AppDelegate에서도 설정해줬던 기억이 있는데, SceneDelegate 기준으로 작성한다.
'iOS > Swift' 카테고리의 다른 글
[TIL / 25.03.27] HarryPotterBooks 과제 2~4Lv 구현 및 회고 (1) | 2025.03.27 |
---|---|
HarryPotterBooks 과제 1레벨 기록 (0) | 2025.03.25 |
[TIL / 25.03.20] 최적화(OptimizationTips) 2 (0) | 2025.03.20 |
[TIL / 25.03.19] playground, command line tool에서의 비동기 함수 (feat. escaping closure) (2) | 2025.03.19 |
[TIL / 25.03.18] 최적화(OptimizationTips) 1 (5) | 2025.03.18 |