<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/NSViewRepresentableContext/coordinator",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI26NSViewRepresentableContextV11coordinator11CoordinatorQzvp"
  },
  "title" : "coordinator"
}
-->

# coordinator

An instance you use to communicate your AppKit view’s behavior and state
out to SwiftUI objects.

```
@MainActor @preconcurrency let coordinator: View.Coordinator
```

## Discussion

The coordinator is a custom instance you define. When updating your
view, communicate changes to SwiftUI by updating the properties of your
coordinator, or by calling relevant methods to make those changes. The
implementation of those properties and methods are responsible for
updating the appropriate SwiftUI values. For example, you might define a
property in your coordinator that binds to a SwiftUI value, as shown in
the following code example. Changing the property updates the value of
the corresponding SwiftUI variable.

```
class Coordinator: NSObject {
   @Binding var rating: Int
   init(rating: Binding<Int>) {
      $rating = rating
   }
}
```

To create and configure your custom coordinator, implement the
[`makeCoordinator()`](/documentation/SwiftUI/NSViewControllerRepresentable/makeCoordinator()) method of your
[`NSViewControllerRepresentable`](/documentation/SwiftUI/NSViewControllerRepresentable) object.

---

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)