---
title: removeFromParent()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsviewcontroller/removefromparent()
---

# removeFromParent()

Removes the called view controller from its parent view controller.

## Declaration

```swift
func removeFromParent()
```

## Discussion

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:) method to perform that work and call that method. This is a convenience method that calls the removeChild(at:) method, automatically supplying the appropriate index value as an argument.

## See Also

### Managing Child View Controllers in a Custom Container

- [addChild(_:)](appkit/nsviewcontroller/addchild(_:).md)
- [children](appkit/nsviewcontroller/children.md)
- [transition(from:to:options:completionHandler:)](appkit/nsviewcontroller/transition(from:to:options:completionhandler:).md)
- [insertChild(_:at:)](appkit/nsviewcontroller/insertchild(_:at:).md)
- [removeChild(at:)](appkit/nsviewcontroller/removechild(at:).md)
- [preferredContentSizeDidChange(for:)](appkit/nsviewcontroller/preferredcontentsizedidchange(for:).md)
