Overview
The system launches your app when the user taps your app’s icon on the Home screen.
Et launch time, UIKit automatically creates the UIApplication object and your app delegate.
It then starts your app’s event loop.
Process
1. App touch
2. swift๋ C ๊ณ์ด์ ์ธ์ด๊ฐ ์๋๊ธฐ ๋๋ฌธ์ main()๊ฐ์ ์์์ ์ด ์์ผ๋ฏ๋ก @main์ด๋ ธํ ์ด์ (xcode 11์ดํ์์๋ @UIApplicationMain)์ ํตํด ์ฑ์ ๋ณธ์ฒด์ ํด๋นํ๋ UIApplication ๊ฐ์ฒด์์ฑ
4. UIApplication ๊ฐ์ฒด๋ Info.plistํ์ผ์ ๋ฐํ์ผ๋ก ์ฑ์ ํ์ํ ๋ฐ์ดํฐ์ ๊ฐ์ฒด ๋ก๋
5. ์ปค์คํ ์ฝ๋๋ฅผ ์ฒ๋ฆฌํ๊ธฐ ์ํด AppDelegate ๊ฐ์ฒด๋ฅผ ์์ฑํ๊ณ UIApplication ๊ฐ์ฒด์ ์ฐ๊ฒฐ
6. AppDelegate์ func application(UIApplication, willFinishLaunchingWithOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool ๋ฉ์๋๋ฅผ ํตํด ์คํ์ ํ์ํ ์ค๋น ์งํ
7. ์คํ ์ง์ func application(UIApplication,didFinishLaunchingWithOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool ํจ์ ํธ์ถ
8. Main run loop ์คํ ๋ฐ ์ด๋ฒคํธ ํ๋ฅผ ์ด์ฉํด ์ด๋ฒคํธ ์์ฐจ ์ฒ๋ฆฌ
9. ์ฑ์ ๋ ์ด์ ์ฌ์ฉํ์ง ์์ผ๋ฉด iOS system์ terminate ๋ฉ์์ง ์ ๋ฌ, applicationWillTerminate(_:) ์คํ
10. ์ฑ ์ข ๋ฃ
Main run loop
Main Run Loop๋ผ๋ ๊ฒ์ ์ ์ ๊ฐ ์ผ์ผํค๋ ์ด๋ฒคํธ๋ค์ ์ฒ๋ฆฌํ๋ ํ๋ก์ธ์ค์ ๋๋ค.
UIApplication ๊ฐ์ฒด๋ ์ฑ์ด ์คํ๋ ๋, Main Run Loop๋ฅผ ์คํ
Main Run Loop๋ฅผ View์ ๊ด๋ จ๋ ์ด๋ฒคํธ๋ View์ ์ ๋ฐ์ดํธ์ ํ์ฉ
Main Run Loop๋ View์ ๊ด๋ จ๋์ด ์๊ธฐ ๋๋ฌธ์ Main ์ฐ๋ ๋์์ ์คํ๋ฉ๋๋ค.
'iOS ๐ > iOS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
viewcontroller๊ฐ ๋ฐ์ดํฐ ์ ๋ฌํ๋ 6๊ฐ์ง ๋ฐฉ๋ฒ (0) | 2021.03.02 |
---|---|
Managing iOS App's Life Cycle (0) | 2021.02.24 |
MVC, MVP, MVVM Pattern (0) | 2021.02.17 |
Delegation Pattern (0) | 2021.02.17 |
Design Pattern (0) | 2021.02.16 |