Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
詳解UIWindow
Search
Atsuya Sato
August 23, 2024
Programming
3
2.8k
詳解UIWindow
2024/08/22(木)~24(土)に開催されたiOSDC Japan 2024で発表した2024/08/23 15:40〜 Track A「詳解UIWindow」の資料です
Atsuya Sato
August 23, 2024
Tweet
Share
More Decks by Atsuya Sato
See All by Atsuya Sato
画面最前面に表示されるデバッグツールを作る
natmark
2
160
最低サポートOSバージョンをあげた時のストア表示について / potatotips81-store-page-apperance-with-deployment-target-updated
natmark
2
490
施策基盤としてのディープリンク〜なめらかにアプリが開く体験のために〜
natmark
9
7.1k
チームでSwiftUIを書くために / After Party iOSDC Japan 2021 SwiftUI
natmark
3
1k
iOSDC_SwiftUI_Text
natmark
4
5.4k
Service development lecture in Cookpad Online Summer Internship 2020
natmark
1
7.8k
防犯システムのプロトタイピングを SORACOMのサービスを用いて爆速で行う
natmark
0
170
動かして理解するGitの内側
natmark
3
2.1k
CA-FUN-LT-ProcessingKit.pdf
natmark
0
600
Other Decks in Programming
See All in Programming
フロントエンドの現在地とこれから
koba04
10
4.5k
선언형 UI를 학습할 때 알아둬야하는 키워드들
l2hyunwoo
0
140
Beyond Laravel Octane - Hyperf for Laravel Artisans
albertcht
1
130
Remix × Cloudflare Pages × Sentry 奮闘記 / remix-pages-sentry
nkzn
1
420
◯◯エンジニアになった理由
gessy0129
PRO
0
650
What is TDD?
urakawa_jinsei
1
220
Removing Corepack
yosuke_furukawa
PRO
9
1.2k
Pydantic x Database API:turu-pyの開発
yassun7010
1
570
(Deep|Web) Link support with expo-router
mrtry
0
170
NEWTにおけるiOS18対応の進め方
ryu1sazae
0
230
Vue :: Better Testing 2024
up1
1
400
Pythonによるイベントソーシングへの挑戦と現状に対する考察 / Challenging Event Sourcing with Python and Reflections on the Current State
nrslib
3
1.2k
Featured
See All Featured
Writing Fast Ruby
sferik
626
60k
How to Ace a Technical Interview
jacobian
275
23k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
167
49k
From Idea to $5000 a Month in 5 Months
shpigford
381
46k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
43
6.5k
In The Pink: A Labor of Love
frogandcode
139
22k
Agile that works and the tools we love
rasmusluckow
327
21k
Faster Mobile Websites
deanohume
304
30k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
GraphQLとの向き合い方2022年版
quramy
43
13k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.3k
Transcript
ৄղUIWindow iOSDC Japan 2024 2024/08/23(ۚ) 15:40-16:00 Track A 1 pixiv
Inc. atsuyan
2 atsuyan / ͋ͭ (𝕏: @n_atmark) ϐΫγϒגࣜձࣾ ৽نࣄۀ෦ iOSΤϯδχΞ 20242݄த్ೖࣾ
iPad͚ϖΠϯτπʔϧPastelaͷ։ൃΛ୲ ϘϧμϦϯά͕झຯͰ͢!
3
ΞδΣϯμ • UIWindowͲ͏͍͏Ϋϥεͳͷ͔ • UIWindowͷදࣔํ๏ͱಛੑʹ͍ͭͯ • SwiftUIͰͷUIWindowऔಘʹ͍ͭͯ • ·ͱΊ 4
UIWindowͲ͏͍͏Ϋϥεͳͷ͔ 5
6 UIWindow | Apple Developer Documentation - https://developer.apple.com/documentation/uikit/uiwindow
UIWindowͷׂ 7 ΞϓϦͷίϯςϯπΛදࣔ͢ΔͨΊͷΟϯυͷఏڙ
UIWindowͷׂ • දࣔ͢ΔrootViewControllerͷཧ • ࠲ඪͷม • ΩʔϘʔυΠϕϯτͷλʔήοτཧ • ΟϯυͷॏͳΓ(Z࣠Ϩϕϧ)ͷཧ 8
ΞϓϦͷίϯςϯπΛදࣔ͢ΔͨΊͷΟϯυͷఏڙ
UIWindowͷׂ • දࣔ͢ΔrootViewControllerͷཧ 9 var rootViewController: UIViewController? { get set
}
UIWindowͷׂ • ࠲ඪͷม 10 func convert(_ point: CGPoint, to window:
UIWindow?) -> CGPoint func convert(_ point: CGPoint, from window: UIWindow?) -> CGPoint func convert(_ rect: CGRect, to window: UIWindow?) -> CGRect func convert(_ rect: CGRect, from window: UIWindow?) -> CGRect
UIWindowͷׂ • ΩʔϘʔυΠϕϯτͷλʔήοτཧ 11 var isKeyWindow: Bool { get }
var canBecomeKey: Bool { get } func makeKeyAndVisible() func makeKey() func becomeKey() func resignKey()
UIWindowͷׂ • ΟϯυͷॏͳΓ(Z࣠Ϩϕϧ)ͷཧ 12 var windowLevel: UIWindow.Level { get set
}
UIWindowͷؔ࿈Ϋϥε • ը໘αΠζΛऔಘ͍ͨ͠߹ʹݕ౼͞ΕΔΫϥε • UIScreen • UIWindowScene • UIWindow •
UIView 13
14 Introducing Multiple Windows on iPad | WWDC19 - https://developer.apple.com/videos/play/wwdc2019/212/
~ iOS 13.0
15 Introducing Multiple Windows on iPad | WWDC19 - https://developer.apple.com/videos/play/wwdc2019/212/
iOS 13.0+
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"Apple Studio Display Free Mockups" © BRIX Templates (Licensed under
CC BY 4.0) "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
"Apple Studio Display Free Mockups" © BRIX Templates (Licensed under
CC BY 4.0) "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
UIWindowͷؔ࿈Ϋϥε • UIScreen … ཧతͳσόΠεͷը໘αΠζ • UIWindowScene … γʔϯͷը໘αΠζ •
UIWindow … Οϯυͷը໘αΠζ • UIView … Viewͷը໘αΠζ 29
αΠζΛͲ͏औಘ͢Δ͔ • αΠζऔಘͷҙ 30 UIApplication.shared.keyWindow UIApplication.shared.windows UIScreen.screens UIScreen.main
αΠζΛͲ͏औಘ͢Δ͔ • αΠζऔಘͷҙ 31 @available(iOS, introduced: 2.0, deprecated: 13.0, message:ŋŋŋ)
UIApplication.shared.keyWindow @available(iOS, introduced: 2.0, deprecated: 15.0, message:ŋŋŋ) UIApplication.shared.windows @available(iOS, introduced: 3.2, deprecated: 16.0, message:ŋŋŋ) UIScreen.screens // soft-deprecated @available(iOS, introduced: 2.0, deprecated: 100000, message:ŋŋŋ) UIScreen.main
UIScreen.screens ͲͷΠϯελϯε ͕Ͳͬͪͩ…? iPadଆͷαΠζҰԠUIScreen.main ͰऔΕ͢Δ͕… (soft-deprecated) "Apple Studio Display Free
Mockups" © BRIX Templates (Licensed under CC BY 4.0) "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
UIApplication.shared.connectedScenes ͲͷΠϯελϯε͕ Ͳͷγʔϯͩ…? "Apple Studio Display Free Mockups" © BRIX
Templates (Licensed under CC BY 4.0) "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
UIApplication.shared.windows ͍ͬͺ͍͋Δͧ…? "Apple Studio Display Free Mockups" © BRIX Templates
(Licensed under CC BY 4.0) "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
keyWindowͬͯͲΕͩ??? UIApplication.shared.keyWindow ? ? ? ? "Apple Studio Display Free
Mockups" © BRIX Templates (Licensed under CC BY 4.0) "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
windowScene.windows ͲͷΠϯελϯε ͕Ͳͬͪͩ…? "Apple Studio Display Free Mockups" © BRIX
Templates (Licensed under CC BY 4.0) "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
windowScene.keyWindow keyWindowͬͯͲΕͩ??? ? ? "Apple Studio Display Free Mockups" ©
BRIX Templates (Licensed under CC BY 4.0) "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
αΠζΛͲ͏औಘ͢Δ͔ • ྫ͑ • ֎෦σΟεϓϨΠଓ࣌ʹ͕ࣗࣗͲͷσόΠεͷεΫ Ϧʔϯͳͷ͔UIScreenͰ͔Βͳ͍ (αΠζͰஅ͢Δͱ ͍͏ख͋Δ͕…) • ಉ͡Α͏ʹSplitViewͷࠨଆͷUIWindowScene͕ͲΕͳͷ͔ɻ
Έ͍ͨͳࣄconnectedScenes͔Β͔Βͳ͍ 38
αΠζΛͲ͏औಘ͢Δ͔ 39 UIViewͷํ͔Βॱ൪ʹḷΔͷ͕ྑ͍
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
view.window @MainActor class UIView : UIResponder { var window: UIWindow?
{ get } } "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
@MainActor class UIWindow : UIView { weak var windowScene: UIWindowScene?
{ get set } } window.windowScene "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
@MainActor class UIWindowScene : UIScene { var screen: UIScreen {
get } } windowScene.screen "iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
αΠζΛͲ͏औಘ͢Δ͔ 44 UIViewͷํ͔Βॱ൪ʹḷΔͷ͕ྑ͍ • UIView͔Βॱ൪ʹḷΔ͜ͱͰରԠ͢Δ্ҐΫϥεΛऔಘͰ͖Δ • UIView 1 — 0…1
UIWindow • UIWindow 1 — 0..1 UIWindowScene • UIWindowScene 1 — 1 UIScreen (SwiftUIʹ͍ͭͯޙ΄Ͳ)
UIWindowͷදࣔํ๏ͱಛੑʹ͍ͭͯ 45
UIWindowͷ׆༻ • UIView (UIViewController) Ͱͳ͘ΟϯυͷϨΠϠʔͰॏͳ ΓΛཧͰ͖Δ • άϩʔόϧʹը໘࠷લ໘ʹཁૉΛදࣔ͢Δͷʹར༻Ͱ͖Δ • શը໘ϩʔσΟϯάͷදࣔ
• τʔετͷදࣔ • σόοάπʔϧͷදࣔͳͲ 46
47 UIWindowͷॏͳΓͰ ProgressΛ࣮ UIViewͷॏͳΓͰ ProgressΛ࣮ "iPhone mockups" © Clément Diouloufet
(Licensed under CC BY 4.0)
UIWindowͷ׆༻ • ཁૉΛॏͶΔ͚ͩͳΒUIViewͷaddSubViewͰ্ʹॏͶͨΓɺ SwiftUIͷ ZStack / overlay ͕͋Δ • ྫ͑
UIViewContoller Λpresentͨ͠ΓSwiftUIͰsheetΛදࣔ͠ ͨΓ͢Δͱɺը໘࠷લ໘Ͱͳ͘ͳͬͯ͠·͏ • ৗʹը໘࠷લ໘ʹද͍ࣔͨ࣌͠ʹUIWindow͕ศར 48
UIWindowͷදࣔ • UIWindowͷදࣔUIViewͷΑ͏ʹ addSubView(_:) ͢Δܗࣜͱ গ͠ҟͳΔ 49
UIWindowͷදࣔ 50 final 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) // ᶄ rootViewControllerͷઃఆ window.rootViewController = CustomViewController() // ᶅ UIWindowͷදࣔ window.makeKeyAndVisible() // ᶆ Πϯελϯεͷอ࣋ self.window = window } }
makeKeyAndVisibleʹ͍ͭͯ 51
makeKeyAndVisibleʹ͍ͭͯ 52
makeKeyAndVisibleͷޡղ • makeKeyAndVisible() ɺUIWindowΛΩʔΟϯυ (isKeyWindow: true) ʹͯ͠UIWindowΛදࣔঢ়ଶʹ͢Δॲཧ • ΩʔΟϯυʹͳΔ͜ͱͰը໘࠷લ໘ʹදࣔ͞ΕΔͱࢥΘ ΕΔ͜ͱ͕͋Δ͕ɺؔͳ͍
53
UIWindowΛը໘࠷લ໘ʹදࣔ͢Δʹ • Z࣠ࢦఆ͢Δͷʹ windowLevel: UIWindow.Level ͕͋Δ • windowLevel ͷߴ͍ॱʹલ໘ͱͳ͍ͬͯΔ •
public init(_ rawValue: CGFloat) • UIWindow.Level (.normal / .alert / .statusBar) 54
UIWindowΛը໘࠷લ໘ʹදࣔ͢Δʹ • windowLevel ͕ಉ͡UIWindowؒͷલޙͲ͏ܾ·͍ͬͯΔʁ • isKeyWindow ͕ઌ಄Λอূ͢ΔͷͰͳ͍ • UIApplication.shared.windows ͷ߱ॱͰͳ͍
• windowScene.windows ͷ߱ॱͰͳ͍ 55
UIWindowΛը໘࠷લ໘ʹදࣔ͢Δʹ • windowLevel ͕ಉ͡UIWindowؒʹ͓͚Δදࣔॱ • ৽͘͠ visible ঢ়ଶʹͳͬͨUIWindow΄Ͳલʹදࣔ͞ΕΔ 56
UIWindowΛը໘࠷લ໘ʹදࣔ͢Δʹ • windowLevel ͕ಉ͡UIWindowؒʹ͓͚Δදࣔॱ • ৽͘͠ visible ঢ়ଶʹͳͬͨUIWindow΄Ͳલʹදࣔ͞ΕΔ 57 UIWindow
ͷ visibility ʹมߋ͕͋ͬͨࡍʹ UIWindow.didBecomeVisibleNotification Ͱߋ৽͞Εͨ UIWindow ͕௨͞ΕΔͷͰɺ͜Εͷ௨͕࠷ޙʹ͞Εͨͷ*1 *1: Undocumented ͕ͩɺprivate APIΛίʔϧͯ͠ௐͯΈͨײ͓ͦ͡Β࣮͘ࡍͷදࣔॱܾఆ UIScene ͕ ෦Ͱอ͍࣋ͯ͠Δ NSArray *_visibleWindows ॱʹͳ͍ͬͯͦ͏
ΩʔΟϯυͱ • UIWindowScene͝ͱʹҰ͚ͭͩଘࡏ͢Δ isKeyWindow ͷ͕ true ͱͳ͍ͬͯΔUIWindow • ΩʔೖྗΛड͚͚ΒΕΔUIWindow •
࠲ඪΛ࣋ͨͳ͍ΠϕϯτΛ௨͢ΔͨΊʹΘΕΔ 58
59 UIWindow1 UIWindow2 UIWindow3 "iPad Pro Mockup" © Eduard (Licensed
under CC BY 4.0)
60 UIWindow1 UIWindow2 UIWindow3 "iPad Pro Mockup" © Eduard (Licensed
under CC BY 4.0) "Mac Keyboard Mockup for Figma" © ͋͛ (Licensed under CC BY 4.0) ? ? ?
61 UIWindow1 UIWindow2 UIWindow3 "iPad Pro Mockup" © Eduard (Licensed
under CC BY 4.0) "Mac Keyboard Mockup for Figma" © ͋͛ (Licensed under CC BY 4.0) isKeyWindow: false isKeyWindow: false isKeyWindow: true isKeyWindow: true
ΩʔΟϯυͱ • ը໘ͷλοϓϚεϗόʔͳͲ࠲ඪΛ࣋ͭΠϕϯτ • λοϓҐஔʹଘࡏ͢ΔUIWindow͕ΠϕϯτΛड͚औΔ • ΩʔϘʔυೖྗͳͲͷ࠲ඪΛ࣋ͨͳ͍ΠϕϯτΩʔΟϯ υ͕ड͚औΔ ͨͩ͠ΩʔΟϯυҎ֎ͷUIWindow͕ʮ࠲ඪΛ࣋ͭΠϕϯ τʯड͚औΔͱΩʔΟϯυҠΓมΘΔͷͰҙ
62
ͦͷଞͷؾΛ͚ͭΔ͖UIWindowͷಛੑက • ྫ͑ϑϨʔϜͷڍಈ • UIWindowͷ frame.size ͕UIWindowSceneͷ coordinateSpace.bounds.size ͱಉ͡߹ •
ʮશը໘දࣔʯ͞Ε͍ͯΔͱΈͳ͞ΕΔ 63
"iPad Pro Mockup" © Eduard (Licensed under CC BY 4.0)
64
ͦͷଞͷؾΛ͚ͭΔ͖UIWindowͷಛੑက • ʮશը໘දࣔʯ͞Ε͍ͯΔ߹ • frame.origin ʹͲΜͳΛઃఆͯ͠ CGPoint.zero Ͱ্ॻ͖͞ Εͯ͠·͏ 65
ͦͷଞͷؾΛ͚ͭΔ͖UIWindowͷಛੑက • ྫ͑εςʔλεόʔͷڍಈ • εςʔλεόʔͷදࣔɾඇදࣔʮશը໘දࣔ͞Ε͍ͯΔʯ UIWindowͷ͏ͪʮ࠷લ໘දࣔʯ͞Ε͍ͯΔUIWindowʹඥͮ ͘rootViewControllerͷ prefersStatusBarHidden ʹӨڹΛड͚ Δ
66
ͦͷଞͷؾΛ͚ͭΔ͖UIWindowͷಛੑက 67 final class CustomViewController: UIViewController { private var isHidden:
Bool override var prefersStatusBarHidden: Bool { return isHidden } init(isHidden: Bool, color: UIColor?) { self.isHidden = isHidden super.init(nibName: nil, bundle: nil) view.backgroundColor = color } @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } }
68 @main class AppDelegate: UIResponder, UIApplicationDelegate { var windows: [UIWindow]
= [] func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?) -> Bool { let blueWindow = UIWindow(frame: UIScreen.main.bounds) blueWindow.rootViewController = CustomViewController(isHidden: false, color: .blue) blueWindow.windowLevel = .init(2) blueWindow.isHidden = false windows.append(blueWindow) let redWindow = UIWindow(frame: UIScreen.main.bounds) // ΑΓલ໘ʹ࠷લ໘දࣔ͞ΕͨblueWindow͕͍ΔͷͰεςʔλεόʔӅΕͳ͍ redWindow.rootViewController = CustomViewController(isHidden: true, color: .red) redWindow.windowLevel = .init(1) redWindow.isHidden = false windows.append(redWindow) let greenWindow = UIWindow(frame: .init(x: 20, y: 20, width: 100, height: 100)) // ࠷લ໘ʹදࣔ͞Ε͍ͯΔ͕શը໘දࣔ͞Ε͍ͯͳ͍ͷͰεςʔλεόʔӅΕͳ͍ greenWindow.rootViewController = CustomViewController(isHidden: true, color: .green) greenWindow.windowLevel = .init(3) greenWindow.isHidden = false windows.append(greenWindow) return true } }
SwiftUIͰͷUIWindowදࣔʹ͍ͭͯ 69
SwiftUIͰUIWindowΛऔಘ͢Δ • 1: AppͷView͔Βऔಘ͢Δ߹ • 2: App֎Ͱ࡞ͨ͠UIWindowʹඥͮ͘SwiftUIͷView͔Βऔಘ͢ Δ߹ 70
AppͷView͔Βऔಘ͢Δ߹ • AppͷView͔ΒUIWindowΛऔಘ͍ͨ͠߹ObservableObject ͳSceneDelegateΛར༻͢Δͱྑ͍ 71
1: AppͷView͔Βऔಘ͢Δ߹ 72 @main struct SampleAppApp: App { // UIApplicationDelegateAdaptorΛར༻͢Δ
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate var body: some Scene { WindowGroup { ContentView() } } } final class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { let configuration = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) if connectingSceneSession.role == .windowApplication { configuration.delegateClass = SceneDelegate.self } return configuration } }
1: AppͷView͔Βऔಘ͢Δ߹ 73 final class SceneDelegate: UIResponder, UIWindowSceneDelegate, ObservableObject {
var window: UIWindow? func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = scene as? UIWindowScene else { return } self.window = windowScene.keyWindow // γʔϯͷଓ࣌ʹkeyWindowΛͱͬͯͳ͍ (UIWindow͕Ұ͚ͭͩͳͷͰ) } }
1: AppͷView͔Βऔಘ͢Δ߹ 74 struct ContentView: View { @EnvironmentObject var sceneDelegate:
SceneDelegate var body: some View { // EnvironmentObject͔Βऔಘͨ͠sceneDelegateΛར༻ͯ͠ sceneDelegate.window͕ར༻Ͱ͖Δ } }
2: App֎Ͱ࡞ͨ͠UIWindowͷ߹ 75 extension UIWindow: ObservableObject {} final class SceneDelegate:
NSObject, 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) // environmentObjectͰUIWindowΛͯ͋͛͠Δ window.rootViewController = UIHostingController(rootView: OverlayView().ignoresSafeArea().environmentObject(window)) window.isHidden = false self.window = window } }
2: App֎Ͱ࡞ͨ͠UIWindowͷ߹ 76 struct OverlayView: View { @EnvironmentObject var window:
UIWindow var body: some View { // EnvironmentObject͔Βऔಘͨ͠window͕ར༻Ͱ͖Δ } }
UIWindowSceneͷαΠζ͕มΘͬͨ͜ͱΛݕ͍ͨ͠ • windowScene ͷ delegate ϝιουʹ↓͕͋Δ windowScene(_:didUpdate:interfaceOrientation:traitCollection:) • ͜Ε͑ͦ͏ͳؾ͢Δ͕… 77
UIWindowSceneͷαΠζ͕มΘͬͨ͜ͱΛݕ͍ͨ͠ • windowScene(_:didUpdate:interfaceOrientation:traitCollection:) • UIApplicationDelegateAdaptorܦ༝ͷ߹͜ͷdelegateϝιο υݺΕͳ͍ • UISceneConfigurationͷdelegateClassʹઃఆͨ͠ SceneDelegate͕ͦͷ··ΘΕΔΘ͚Ͱͳ͘ɺ SwiftUI.AppSceneDelegate͕෦తʹར༻͞ΕΔͨΊ
78
UIWindowSceneͷαΠζ͕มΘͬͨ͜ͱΛݕ͍ͨ͠ • WindowGroup ͷԼʹ GeometryReader Λઃஔ͢Δ͔͠ͳ͍͔ … 79
·ͱΊ • UIWindowUIWindowSceneͷαΠζ͕ཉ͍͠߹ΑΓԼҐ ͷΫϥε͔Βٯॱʹḷ͍ͬͯ͘ͱྑ͍ • UIWindowͷදࣔॱܾఆUIViewͱҧ͍ͬͯΔͷͰҙ͕ඞ ཁɻεςʔλεόʔͷදࣔͷڍಈॱ൪͕Өڹ͢Δ • SwiftUI͔ΒUIWindowʹΞΫηε͍ͨ͠߹ UIApplicationDelegateAdaptorΛ࣮͢ΔͱEnvironmentObjectܦ
༝ͰऔಘͰ͖Δ 80