UIHostingSceneDelegate
protocol · iOS 26.0+ · SDK 27.1
protocol UIHostingSceneDelegate : UISceneDelegateExtends ``UIKit/UISceneDelegate`` to bridge SwiftUI scenes. Declare any SwiftUI scenes you wish to activate from UIKit in the static `rootScene` property of your conforming class: class HostingSceneDelegate: UIHostingSceneDelegate { static var rootScene: some Scene { WindowGroup(id: "swiftui-window") { ContentView() } } // Add UISceneDelegate lifecycle callbacks here } Use a class conforming to ``UIHostingSceneDelegate`` to activate a scene by its ID or presented value with `UISceneSessionActivationRequest`: if let requestWithID = UISceneSessionActivationRequest( hostingDelegateClass: HostingSceneDelegate.self, id: "swiftui-window" ) { UIApplication.shared.activateSceneSession(for: requestWithID) } if let requestWithData = UISceneSessionActivationRequest( hostingDelegateClass: HostingSceneDelegate.self, value: FavoriteNumber(13) ) { UIApplication.shared.activateSceneSession(for: requestWithData) } When a SwiftUI scene declared in your `rootScene` property is activated, an instance of your conforming class will be created by SwiftUI and receive window scene lifecycle callbacks. Your `UIHostingSceneDelegate` class can be used with a `UISceneConfiguration` in your app delegate's `application(_:configurationForConnecting:options:)`method to activate a SwiftUI scene in response to an external event: class AppDelegate: UIApplicationDelegate { func application( _ app: UIApplication, configurationForConnecting sceneSession: UISceneSession, options: UIScene.ConnectionOptions ) -> UISceneConfiguration { let config = UISceneConfiguration( name: nil, sessionRole: sceneSession.role) config.delegateClass = HostingSceneDelegate.self return config } }
Members (0)
This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.
Skipped declarations
No declarations were skipped in this snapshot.