---
title: "updateUIViewController(_:context:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/uiviewcontrollerrepresentable/updateuiviewcontroller(_:context:)"
---

# updateUIViewController(_:context:)

Updates the state of the specified view controller with new information from SwiftUI.

## Declaration

```swift
@MainActor @preconcurrency func updateUIViewController(_ uiViewController: Self.UIViewControllerType, context: Self.Context)
```

## Parameters

- `uiViewController`: Your custom view controller object.
- `context`: A context structure containing information about the current state of the system.

## Discussion

Discussion When the state of your app changes, SwiftUI updates the portions of your interface affected by those changes. SwiftUI calls this method for any changes affecting the corresponding UIKit view controller. Use this method to update the configuration of your view controller to match the new state information provided in the context parameter.

## See Also

### Creating and updating the view controller

- [makeUIViewController(context:)](swiftui/uiviewcontrollerrepresentable/makeuiviewcontroller(context:).md)
- [UIViewControllerRepresentable.Context](swiftui/uiviewcontrollerrepresentable/context.md)
- [UIViewControllerType](swiftui/uiviewcontrollerrepresentable/uiviewcontrollertype.md)
