---
title: "updateNSView(_:context:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/nsviewrepresentable/updatensview(_:context:)"
---

# updateNSView(_:context:)

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

## Declaration

```swift
@MainActor @preconcurrency func updateNSView(_ nsView: Self.NSViewType, context: Self.Context)
```

## Parameters

- `nsView`: Your custom view 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 AppKit view. Use this method to update the configuration of your view to match the new state information provided in the context parameter.

## See Also

### Creating and updating the view

- [makeNSView(context:)](swiftui/nsviewrepresentable/makensview(context:).md)
- [NSViewRepresentable.Context](swiftui/nsviewrepresentable/context.md)
- [NSViewType](swiftui/nsviewrepresentable/nsviewtype.md)
