---
title: AppExtensionScene
framework: extensionkit
role: symbol
role_heading: Protocol
path: extensionkit/appextensionscene
---

# AppExtensionScene

An interface you use to provide a specific scene from your app extension’s UI.

## Declaration

```swift
@MainActor @preconcurrency protocol AppExtensionScene
```

## Mentioned in

Including extension-based UI in your interface

## Overview

Overview 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 Including extension-based UI in your interface.

## Topics

### Configuring the app extension

- [body](extensionkit/appextensionscene/body-swift.property.md)
- [Body](extensionkit/appextensionscene/body-swift.associatedtype.md)

## Relationships

### Conforming Types

- [PrimitiveAppExtensionScene](extensionkit/primitiveappextensionscene.md)

## See Also

### UI definition

- [PrimitiveAppExtensionScene](extensionkit/primitiveappextensionscene.md)
- [AppExtensionSceneBuilder](extensionkit/appextensionscenebuilder.md)
