Adds the specified constraint to the layer.
SDKs
- macOS 10.5+
- Mac Catalyst 13.0+
Framework
- Core Animation
Declaration
func addConstraint(_ c: CAConstraint)
Parameters
aConstraint
The constraint object to add to the receiver’s array of constraint objects.
Discussion
In macOS, you typically add constraints to a layer to manage the size and position of that layer’s sublayers. Before constraints can be applied, you must also assign a CAConstraint
object to the layout
property of the layer. For more information about managing layer-based constraints, see Core Animation Programming Guide.
iOS apps do not support layer-based constraints.