---
title: "removeChild(at:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsviewcontroller/removechild(at:)"
---

# removeChild(at:)

Removes a specified child controller from the view controller.

## Declaration

```swift
func removeChild(at index: Int)
```

## Parameters

- `index`: The index in the doc://com.apple.appkit/documentation/AppKit/NSViewController/children array for the child view controller you want to remove.

## Discussion

Discussion Override this method if you want to perform work during the removal of a child view controller. If you do override this method, in your implementation call this method on super. If you just want to remove a child view controller, instead use the removeFromParent() method

## 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)
- [removeFromParent()](appkit/nsviewcontroller/removefromparent().md)
- [preferredContentSizeDidChange(for:)](appkit/nsviewcontroller/preferredcontentsizedidchange(for:).md)
