<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSViewController/removeFromParent()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSViewController(im)removeFromParentViewController"
  },
  "title" : "removeFromParent()"
}
-->

# removeFromParent()

Removes the called view controller from its parent view controller.

```
func removeFromParent()
```

## Discussion

Use this method to remove a child view controller from its parent view controller, unless you want to perform work during the removal. In that case, instead override the [`removeChild(at:)`](/documentation/AppKit/NSViewController/removeChild(at:)) method to perform that work and call that method.

This is a convenience method that calls the [`removeChild(at:)`](/documentation/AppKit/NSViewController/removeChild(at:)) method, automatically supplying the appropriate index value as an argument.

---

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)