AppExtensionScene
protocol · iOS 16.0+ · SDK 27.1
@MainActor @preconcurrency protocol AppExtensionSceneAn interface you use to provide a specific scene from your app extension’s UI. When your app extension provides custom UI, use this type to define a specific scene for that UI. An app extension can define multiple scene types in coordination with the host app. When the host app displays the app extension’s UI, it provides a unique string identifier for the scene it wants to display. The app extension responds by providing an instance of this type that contains that scene's contents. When defining a scene, provide the body of that scene using the ``PrimitiveAppExtensionScene`` type. This type contains the unique identifier of the scene and the content to display. The following code shows an implementation of a scene capable of displaying content you supply at initialization time using a closure. The scene's ``body`` property repackages that content inside the ``PrimitiveAppExtensionScene`` structure. You can also use this type to accept a scene-specific XPC connection, which you might use to communicate custom data related to managing UI-related interactions. ``` struct MyScene<Content: View>: AppExtensionScene { public init(content: @escaping () -> Content) { self.content = content } private let content: () -> Content public var body: some AppExtensionScene { PrimitiveAppExtensionScene(id: “MyScene”) { content() } onConnection: { connection in // TODO: Configure the XPC connection and return true return false } } } ``` For more information about creating UI-based app extensions, see <doc://com.apple.documentation/documentation/extensionkit/including-extension-based-ui-in-your-interface>.
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.