<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITrackingLayoutGuide/setConstraints(_:activeWhenNearEdge:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITrackingLayoutGuide(im)setConstraints:activeWhenNearEdge:"
  },
  "title" : "setConstraints(_:activeWhenNearEdge:)"
}
-->

# setConstraints(_:activeWhenNearEdge:)

Configures the tracking layout guide to automatically activate and deactivate constraints when the guide is close to the given edge.

```
func setConstraints(_ trackingConstraints: [NSLayoutConstraint], activeWhenNearEdge edge: NSDirectionalRectEdge)
```

## Parameters

`trackingConstraints`

The constraints to activate when the tracking layout guide is close to `edge`, and to deactivate when it moves away from `edge`. If you pass `nil`, the guide stops tracking the constraints associated with `edge`.

`edge`

The edge that the tracking layout guide uses to determine whether to activate or deactivate the constraints.

---

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)