<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "tvOS: 27.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UISceneSessionActivationRequest-swift.struct/init(hostingDelegateClass:value:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "s:5UIKit31UISceneSessionActivationRequestV7SwiftUIE20hostingDelegateClass5valueACSgxm_q_tcAD014UIHostingSceneI0RzSeR_SER_SHR_r0_lufc"
  },
  "title" : "init(hostingDelegateClass:value:)"
}
-->

# init(hostingDelegateClass:value:)

Creates a `UISceneSessionActivationRequest` customized to open a SwiftUI
scene with a presented value.

```
init?<H, D>(hostingDelegateClass: H.Type, value: D) where H : UIHostingSceneDelegate, D : Decodable, D : Encodable, D : Hashable
```

## Parameters

`hostingDelegateClass`

A Class type that conforms to
`UIHostingSceneDelegate`.

`value`

The data to be presented in the scene.

## Discussion

The specified scene must be declared in the `rootScene` property of
your hosting delegate class. The initializer will fail if no scene with
the specified identifier is defined.

```
class HostingSceneDelegate: UIHostingSceneDelegate {
    static var rootScene: some Scene {
        WindowGroup(for: FavoriteNumber.self) { $value in
            ContentView(favoriteNumber: $value)
        }
    }
}

if let requestWithData = UISceneSessionActivationRequest(
    hostingDelegateClass: HostingSceneDelegate.self,
    value: FavoriteNumber(13)
) {
    UIApplication.shared.activateSceneSession(for: requestWithData)
}
```

When a UIScene is activated using this request object, its configuration
is managed by SwiftUI. You will not see a call to your app delegate’s
`application(_:configurationForConnecting:)` method.

An instance of the provided hosting delegate class will be created by
SwiftUI and receive lifecycle callbacks for the associated scene.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)