728x90
SnapKit을 활용하여 코드로 앱을 구성할 때 초기 설정을 해주어야 한다.
1. StoryBoard를 체크하여 파일 생성
2. Main (Main.StoryBoard) -> Move to Trash
3. Info (Info.plist)에서 Information Property List > Application Scene Manifest > Scene Configuration > Application Session Role > Item 0 > Storyboard Name 삭제
4. SceneDelegate에 해당 코드 작성
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(windowScene: windowScene)
window?.rootViewController = ViewController() // 시작할 메인 VC를 의미함 (1)
window?.makeKeyAndVisible() // 적용
// 만약 네비게이션 컨트롤러를 포함한 뷰를 원한다면 (1)번 자리에 해당 코드 작성
let rootNavigationController = UINavigationController(rootViewController: ViewController())
window.rootViewController = rootNavigationController
}
}
728x90
'Dev > iOS' 카테고리의 다른 글
[Dev, iOS] 프로퍼티(변수) 값 변경마다 특정 메서드를 실행해야 할 때 (0) | 2022.02.27 |
---|---|
[Dev, iOS] 같은 함수를 여러 프로퍼티에 적용하고 싶을 때 + 버튼에 그림자 만들기 (0) | 2022.02.27 |
[Dev, iOS] Push Notification (알림 메시지) 클릭 시 특정 뷰 오픈하기 (0) | 2022.01.26 |
[Dev, iOS] Storyboard, Protocol 및 Delegate를 활용한 화면 간 데이터 전달 (0) | 2022.01.14 |
[Dev, iOS] Storyboard를 활용한 화면 전환 4가지 방법 (0) | 2022.01.14 |