UIWindow? fileprivate init(mainWindow: UIWindow?) { self.mainWindow = mainWindow super.init(nibName: nil, bundle: nil) } @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } // εςʔλεόʔͷελΠϧ͕mainWindowʹඥͮ͘rootViewControllerͷঢ়ଶʹΑͬͯมΘΔΑ͏ʹ͢Δ override public var childForStatusBarStyle: UIViewController? { return mainWindow?.rootViewController?.childForStatusBarStyle } } UIWindowͷ rootViewController ʹࢦఆ͢Δ༻ͷΧελϚΠζͨ͠UIViewController*1 *1: How to handle status bar with custom overlay UIWindow - Swift Discovery Λࢀߟʹ͠·ͨ͠
mainWindow: UIWindow? fileprivate init(windowScene: UIWindowScene, mainWindow: UIWindow?) { self.mainWindow = mainWindow super.init(windowScene: windowScene) } @available(*, unavailable) required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } // HUDWindowͷrootViewControllerΛΦʔόʔϥΠυ͢Δ͜ͱͰɺHUDHostingViewControllerͷchildForStatusBarStyle͕ίʔϧ͞ΕΔͨΊͷ setNeedsStatusBarAppearanceUpdate͕ݺΕΔλΠϛϯάΛϑοΫͰ͖Δ override public var rootViewController: UIViewController? { get { mainWindow?.rootViewController } set { super.rootViewController = newValue } } } rootViewController ΛΦʔόʔϥΠυͨ͠ΧελϚΠζͷUIWindow*1 *1: How to handle status bar with custom overlay UIWindow - Swift Discovery Λࢀߟʹ͠·ͨ͠