<!--
{
  "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",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITrackingLayoutGuide"
  },
  "title" : "UITrackingLayoutGuide"
}
-->

# UITrackingLayoutGuide

A layout guide that automatically activates and deactivates layout constraints depending on its proximity to edges.

```
@MainActor class UITrackingLayoutGuide
```

## Topics

### Configuring automatic constraint activation

[`func setConstraints([NSLayoutConstraint], activeWhenNearEdge: NSDirectionalRectEdge)`](/documentation/UIKit/UITrackingLayoutGuide/setConstraints(_:activeWhenNearEdge:))

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

[`func setConstraints([NSLayoutConstraint], activeWhenAwayFrom: NSDirectionalRectEdge)`](/documentation/UIKit/UITrackingLayoutGuide/setConstraints(_:activeWhenAwayFrom:))

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

[`func constraints(activeWhenNearEdge: NSDirectionalRectEdge) -> [NSLayoutConstraint]`](/documentation/UIKit/UITrackingLayoutGuide/constraints(activeWhenNearEdge:))

Returns the constraints that the tracking layout guide activates when it’s near the given edge, and deactivates when it’s away from the given edge.

[`func constraints(activeWhenAwayFrom: NSDirectionalRectEdge) -> [NSLayoutConstraint]`](/documentation/UIKit/UITrackingLayoutGuide/constraints(activeWhenAwayFrom:))

Returns the constraints that the tracking layout guide activates when it’s away from the given edge, and deactivates when it’s near the edge.

### Tracking constraints

[`func removeAllTrackedConstraints()`](/documentation/UIKit/UITrackingLayoutGuide/removeAllTrackedConstraints())

Stops the layout guide from tracking any constraints.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`UIPopoverPresentationControllerSourceItem`](/documentation/UIKit/UIPopoverPresentationControllerSourceItem)

[`Hashable`](/documentation/Swift/Hashable)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Sendable`](/documentation/Swift/Sendable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

### Inherited By

[`UIKeyboardLayoutGuide`](/documentation/UIKit/UIKeyboardLayoutGuide)

### Inherits From

[`UILayoutGuide`](/documentation/UIKit/UILayoutGuide)

---

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)