<!--
{
  "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/UIViewControllerRepresentable/dismantleUIViewController(_:coordinator:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI29UIViewControllerRepresentableP09dismantlecD0_11coordinatory0cD4TypeQz_11CoordinatorQztFZ"
  },
  "title" : "dismantleUIViewController(_:coordinator:)"
}
-->

# dismantleUIViewController(_:coordinator:)

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

```
@MainActor @preconcurrency static func dismantleUIViewController(_ uiViewController: Self.UIViewControllerType, coordinator: Self.Coordinator)
```

## Parameters

`uiViewController`

Your custom view controller object.

`coordinator`

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

## Discussion

Use this method to perform additional clean-up work related to your
custom view controller. 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)