---
title: "addSublayer(_:)"
framework: quartzcore
role: symbol
role_heading: Instance Method
path: "quartzcore/calayer/addsublayer(_:)"
---

# addSublayer(_:)

Appends the layer to the layer’s list of sublayers.

## Declaration

```swift
func addSublayer(_ layer: CALayer)
```

## Parameters

- `layer`: The layer to be added.

## Discussion

Discussion If the array in the sublayers property is nil, calling this method creates an array for that property and adds the specified layer to it.

## See Also

### Managing the layer hierarchy

- [sublayers](quartzcore/calayer/sublayers.md)
- [superlayer](quartzcore/calayer/superlayer.md)
- [removeFromSuperlayer()](quartzcore/calayer/removefromsuperlayer().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)
