---
title: "addSceneRepresentation(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsapplication/addscenerepresentation(_:)"
---

# addSceneRepresentation(_:)

Adds the specified SwiftUI scene representation to the current application.

## Declaration

```swift
@MainActor @preconcurrency func addSceneRepresentation<C>(_ representation: NSHostingSceneRepresentation<C>) where C : Scene
```

## Discussion

Discussion Scenes defined by the representation can be presented programmatically via the environment actions available on NSHostingSceneRepresentation, or when the app receives an external event such as a URL. For example, you can add a Settings scene to your app and present it when the corresponding menu item is selected: import AppKit import SwiftUI

@main class ApplicationDelegate: NSApplicationDelegate {     let scene = NSHostingSceneRepresentation {         Settings {             SettingsView()         }     }

func applicationWillFinishLaunching(         _ notification: Notification     ) {         NSApplication.shared.addSceneRepresentation(scene)     }

@IBAction func showAppSettings(_ sender: NSMenuItem) {         scene.environment.openSettings()     } }
