---
title: removeFromSuperlayer()
framework: quartzcore
role: symbol
role_heading: Instance Method
path: quartzcore/calayer/removefromsuperlayer()
---

# removeFromSuperlayer()

Detaches the layer from its parent layer.

## Declaration

```swift
func removeFromSuperlayer()
```

## Discussion

Discussion You can use this method to remove a layer (and all of its sublayers) from a layer hierarchy. This method updates both the superlayer’s list of sublayers and sets this layer’s superlayer property to nil.

## See Also

### Managing the layer hierarchy

- [sublayers](quartzcore/calayer/sublayers.md)
- [superlayer](quartzcore/calayer/superlayer.md)
- [addSublayer(_:)](quartzcore/calayer/addsublayer(_:).md)
- [insertSublayer(_:at:)](quartzcore/calayer/insertsublayer(_:at:).md)
- [insertSublayer(_:below:)](quartzcore/calayer/insertsublayer(_:below:).md)
- [insertSublayer(_:above:)](quartzcore/calayer/insertsublayer(_:above:).md)
- [replaceSublayer(_:with:)](quartzcore/calayer/replacesublayer(_:with:).md)
