티스토리 뷰
728x90
최근 수정일자 (2024.12.28)
오늘은
스토리보드 없이 코드로 작업시 세팅하는 부분에 대해 알아보겠습니다 :)
Xcode 11 버전 이상
Xcode 10 버전 이하
나뉘어져 있으니 본인에 맞는 버전으로 적용하시면 됩니다.
Xcode 11 이상 버전
• Main.storyboard 삭제
Move to Trash 로 파일을 완전 삭제 해줍니다.
• Main.storyboard 에 대한 참조 제거
• Info.plist Storyboard Name 삭제
• main window 생성
SceneDelegate
scene 메소드에서 아래와 같이 입력해줍니다.
// 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 }
let window = UIWindow(windowScene: windowScene)
window.rootViewController = ViewController() // 시작시 띄울 ViewController
window.makeKeyAndVisible()
self.window = window
}
// code ...
}
Xcode 10 이하 버전
• Main.storyboard 삭제
Move to Trash 로 파일을 완전 삭제 해줍니다.
• Main.storyboard 에 대한 참조 제거
아래 사진처럼 진입 후
Deployment Info → Main interface → Main 삭제 → 빈 공간으로 놔두기
• main window 생성
AppDelegate
application(didFinishLaunchingWithOptions launchOptions: ...) 메소드에 아래 코드 입력
// AppDelegate
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = ViewController() // 앱 시작시 처음 보여줄 ViewController
window.makeKeyAndVisible()
self.window = window
return true
}
}
참고
728x90
'iOS' 카테고리의 다른 글
[iOS] 네트워크 연결 확인 (NWPathMonitor) (1) | 2022.04.17 |
---|---|
[iOS] 다크모드 제한 (iOS 13+) (0) | 2022.04.15 |
[Swift] 상속 (Inheritance) (0) | 2022.04.10 |
[iOS] GCD 심화 - 동시성과 관련된 문제들 (Race condition, Tsan, DispatchQueue barrier, Thread-safe, Deadlocks, Priority Inversion) (0) | 2022.04.08 |
[iOS] 메모리 구조 (memory) (0) | 2022.04.06 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- Swift 프로퍼티
- Swift 내림차순
- CS 네트워크
- Swift joined()
- Swift joined
- removeLast()
- Swift 프로그래머스
- Class
- Swift ModernRIBs
- ios
- swift reduce
- 2023년 회고
- iOS error
- 원티드 프리온보딩
- swift programmers
- swift property
- Swift 알고리즘
- Swift init
- Swift
- RIBs tutorial
- swift protocol
- swift (programmers)
- Swift Leetcode
- RTCCameraVideoCapturer
- swift 고차함수
- Swift RIBs
- Swift final
- Swift Error Handling
- Combine: Asynchronous Programming with Swift
- Swift inout
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함