<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/UIViewControllerRepresentableContext",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI36UIViewControllerRepresentableContextV"
  },
  "title" : "UIViewControllerRepresentableContext"
}
-->

# UIViewControllerRepresentableContext

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

```
@MainActor @preconcurrency struct UIViewControllerRepresentableContext<Representable> where Representable : UIViewControllerRepresentable
```

## Overview

A [`UIViewControllerRepresentableContext`](/documentation/SwiftUI/UIViewControllerRepresentableContext) 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 [`UIViewControllerRepresentable`](/documentation/SwiftUI/UIViewControllerRepresentable)
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 controller interactions

[`let coordinator: Representable.Coordinator`](/documentation/SwiftUI/UIViewControllerRepresentableContext/coordinator)

The view’s associated coordinator.

[`var transaction: Transaction`](/documentation/SwiftUI/UIViewControllerRepresentableContext/transaction)

The current transaction.

### Getting the environment data

[`var environment: EnvironmentValues`](/documentation/SwiftUI/UIViewControllerRepresentableContext/environment)

Environment values that describe the current state of the system.

### Instance Methods

[`func animate(changes: () -> Void, completion: (() -> Void)?)`](/documentation/SwiftUI/UIViewControllerRepresentableContext/animate(changes:completion:))

Animates changes using the animation in the current transaction.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)