[Swift] 코드베이스 시작 설정 값

이진규·2024년 6월 30일

Swift

목록 보기
1/4

1.스토리보드 삭제
1-1 Main 스토리보드 삭제 (Move to Trash)
1-2 info파일에서 main검색 후 Storyboard Name 삭제
1-3 프로젝트파일에서 TARGETS 선택 후 Build Settings 이동 main 검색 Main Story
File base name 삭제

  1. 시작 뷰 설정
    2-1 SceneDelegate에서 초반 코드 수정
import UIkit
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    // 윈도우. 앱에 반그시 한 개는 필요한 가장 근본이 되는 뷰. 이 위에 뷰가 쌓이기 시작
    var window: UIWindow?

    // 앱 시작할때 세팅해줄 코드를 작성하는 곳.
    func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
        //UIWindow 객체생성.
        guard let windowScene = (scene as? UIWindowScene) else { return }
        let window = UIWindow(windowScene: windowScene)
        
        // window 에게 루트 뷰 지정.
        window.rootViewController = ViewController()
        
        // 이 메서드를 만드시 작성해줘야 원도우가 활성화 됨.
        window.makeKeyAndVisible()
        self.window = window
    }
    
        
        
        
        
        
        
        
        
        
        
        
        
        
profile
열공중~

0개의 댓글