[Dev, iOS] StoryBoard 없이 시작하기 (Xcode 13)

2022. 1. 27. 14:56·Dev/iOS
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
'Dev/iOS' 카테고리의 다른 글
  • [Dev, iOS] 프로퍼티(변수) 값 변경마다 특정 메서드를 실행해야 할 때
  • [Dev, iOS] 같은 함수를 여러 프로퍼티에 적용하고 싶을 때 + 버튼에 그림자 만들기
  • [Dev, iOS] Push Notification (알림 메시지) 클릭 시 특정 뷰 오픈하기
  • [Dev, iOS] Storyboard, Protocol 및 Delegate를 활용한 화면 간 데이터 전달
100두산
100두산
출발하게 만드는 힘이 동기라면, 계속 나아가게 만드는 힘은 습관이다.
  • 100두산
    정상에서 보자 ✈️
    100두산
  • 전체
    오늘
    어제
    • 분류 전체보기 (126)
      • Life (6)
        • living (1)
      • Research (6)
      • AI (20)
      • Dev (45)
        • iOS (28)
        • Web (4)
        • flutter (9)
        • etc (4)
      • PS (Problem Solving) (23)
      • Computer Science and Engine.. (21)
        • Data Structures and Algorit.. (13)
        • OOP (Object Oriented Progra.. (8)
      • etc (5)
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
    • 글쓰기
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    ios
    Challenger
    D3
    BOJ
    파이썬
    자료구조
    백트래킹
    백준
    오블완
    알고리즘
    PS
    TIP
    SKT
    c++
    AI
    xcode
    티스토리챌린지
    Python
    swift
    SKTelecom
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.2
100두산
[Dev, iOS] StoryBoard 없이 시작하기 (Xcode 13)
상단으로

티스토리툴바