<!--
{
  "availability" : [
    "macOS: 10.15.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/NSViewRepresentable/dismantleNSView(_:coordinator:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI19NSViewRepresentableP09dismantleC0_11coordinatory0C4TypeQz_11CoordinatorQztFZ"
  },
  "title" : "dismantleNSView(_:coordinator:)"
}
-->

# dismantleNSView(_:coordinator:)

Cleans up the presented AppKit view (and coordinator) in anticipation of
their removal.

```
@MainActor @preconcurrency static func dismantleNSView(_ nsView: Self.NSViewType, coordinator: Self.Coordinator)
```

## Parameters

`nsView`

Your custom view object.

`coordinator`

The custom coordinator you use to communicate changes
back to SwiftUI. If you do not use a custom coordinator instance, the
system provides a default instance.

## Discussion

Use this method to perform additional clean-up work related to your
custom view. For example, you might use this method to remove observers
or update other parts of your SwiftUI interface.

---

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)