---
title: isActive
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nslayoutconstraint/isactive
---

# isActive

The active state of the constraint.

## Declaration

```swift
var isActive: Bool { get set }
```

## Discussion

Discussion You can activate or deactivate a constraint by changing this property. Note that only active constraints affect the calculated layout. If you try to activate a constraint whose items have no common ancestor, an exception is thrown. For newly created constraints, the isActive property is false by default. Activating or deactivating the constraint calls addConstraint(_:) and removeConstraint(_:) on the view that is the closest common ancestor of the items managed by this constraint. Use this property instead of calling addConstraint(_:) or removeConstraint(_:) directly.

## See Also

### Activating and deactivating constraints

- [activate(_:)](appkit/nslayoutconstraint/activate(_:).md)
- [deactivate(_:)](appkit/nslayoutconstraint/deactivate(_:).md)
