ํ๋ก์ ํธ๋ฅผ ์๋ก ์์ฑํ๋ฉด SceneDelegate ์์ window ํ๋กํผํฐ๊ฐ ๋ค์๊ณผ ๊ฐ์ด ์ ์ธ๋์ด ์๋ค.
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
}
UIWindow ๊ฐ์ฒด๋ UIView๋ฅผ ์์ํ๋๋ฐ, ๊ณต์ ๋ฌธ์์์๋ ๋ค์ ๋ ๊ฐ์ง ์ํฉ์์๋ง windows ์ฌ์ฉํด์ผ ํ๋ค๊ณ ์ค๋ช ํ๊ณ ์๋ค.
@MainActor class UIWindow : UIView
You use windows only when you need to do the following:
Provide a main window to display your appโs content.
Create additional windows (as needed) to display additional content.
app์ ์ปจํ ์ธ ๋ฅผ ํ์ํ๊ธฐ ์ํ mian window๋ Xcode ํ ํ๋ฆฟ์ด ์คํ ๋ฆฌ๋ณด๋๋ฅผ ์ด์ฉํด ์๋์ผ๋ก ์ ๊ณตํด์ฃผ๊ณ ์๋ค. ๋ฐ๋ผ์, Main ์คํ ๋ฆฌ๋ณด๋๋ฅผ ์ฌ์ฉํ์ง ์๋๋ค๋ฉด ์ง์ window ๊ฐ์ฒด๋ฅผ ์์ฑํด์ผ ํ๋ค.
๊ทธ ์ธ์ iOS 13๋ถํฐ ์ง์ํ๋ ๋ฉํฐ ์๋์ฐ๋ฅผ ๊ตฌํํ๋ ค๋ฉด window ๊ฐ์ฒด๋ฅผ ์ถ๊ฐ๋ก ์์ฑํด์ผ ํ๋ค.
๋ฉํฐ ์๋์ฐ๋ ์ฃผ๋ก ๋ ๋ฐ๋ฅธ ์คํฌ๋ฆฐ์ ์ปจํ
์ธ ๋ฅผ ํ์ํ๊ธฐ ์ํด ์ฌ์ฉ๋๋ค.
(extra windows are commonly used to display content on an external screen, as described in Displaying Content on a Connected Screen.)
UIWindow ๊ฐ์ฒด๋ฅผ ๋ค์๊ณผ ๊ฐ์ ์์ ์ ํ ๋ ์ฌ์ฉํ ์๋ ์๋ค.
- Setting the z-axis level of your window, which affects the visibility of the window relative to other windows.
- Showing windows and making them the target of keyboard events.
- Converting coordinate values to and from the windowโs coordinate system.
- Changing the root view controller of a window.
- Changing the screen on which the window is displayed.
ํ ์ค ์์ฝ.๐
UIWindow๋ UIView๋ฅผ ์์๋ฐ๋ app์ ์ปจํ
์ด๋ ๋ทฐ๋ก,
app์ ์ปจํ
์ธ ๋ฅผ ํ์ํ๊ฑฐ๋ ์ฐ๊ฒฐ๋ ๋ค๋ฅธ ์คํฌ๋ฆฐ์ ํ์ํ๊ธฐ ์ํ ์ถ๊ฐ window๊ฐ ํ์ํ ๋ ์ฌ์ฉ๋๋ค.