---
title: NSViewControllerRepresentableContext
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/nsviewcontrollerrepresentablecontext
---

# NSViewControllerRepresentableContext

Contextual information about the state of the system that you use to create and update your AppKit view controller.

## Declaration

```swift
@MainActor @preconcurrency struct NSViewControllerRepresentableContext<ViewController> where ViewController : NSViewControllerRepresentable
```

## Overview

Overview An NSViewControllerRepresentableContext structure contains details about the current state of the system. When creating and updating your view controller, the system creates one of these structures and passes it to the appropriate method of your custom NSViewControllerRepresentable instance. Use the information in this structure to configure your view controller. For example, use the provided environment values to configure the appearance of your view controller and views. Don’t create this structure yourself.

## Topics

### Coordinating view-related interactions

- [coordinator](swiftui/nsviewcontrollerrepresentablecontext/coordinator.md)
- [transaction](swiftui/nsviewcontrollerrepresentablecontext/transaction.md)

### Getting the current environment data

- [environment](swiftui/nsviewcontrollerrepresentablecontext/environment.md)

### Instance Methods

- [animate(changes:completion:)](swiftui/nsviewcontrollerrepresentablecontext/animate(changes:completion:).md)

## Relationships

### Conforms To

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Adding AppKit views to SwiftUI view hierarchies

- [NSViewRepresentable](swiftui/nsviewrepresentable.md)
- [NSViewRepresentableContext](swiftui/nsviewrepresentablecontext.md)
- [NSViewControllerRepresentable](swiftui/nsviewcontrollerrepresentable.md)
