<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSLayoutConstraint/isActive",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLayoutConstraint(py)active"
  },
  "title" : "isActive"
}
-->

# isActive

The active state of the constraint.

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

## 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`](/documentation/AppKit/NSLayoutConstraint/isActive) property is <doc://com.apple.documentation/documentation/Swift/false> by default.

Activating or deactivating the constraint calls [`addConstraint(_:)`](/documentation/AppKit/NSView/addConstraint(_:)) and [`removeConstraint(_:)`](/documentation/AppKit/NSView/removeConstraint(_:)) on the view that is the closest common ancestor of the items managed by this constraint. Use this property instead of calling [`addConstraint(_:)`](/documentation/AppKit/NSView/addConstraint(_:)) or [`removeConstraint(_:)`](/documentation/AppKit/NSView/removeConstraint(_:)) directly.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)