---
title: "locationHeadingAnchor(manager:isEnabled:)"
framework: SwiftUI
role: symbol
role_heading: Instance Method
platforms: [iOS 27.2+, iPadOS 27.2+]
path: "swiftui/view/locationheadinganchor(manager:isenabled:)"
---

# locationHeadingAnchor(manager:isEnabled:)

Specifies this view as the reference body for the location manager’s heading calculations.

## Declaration

```swift
nonisolated func locationHeadingAnchor(manager: CLLocationManager, isEnabled: Bool = true) -> some View

```

## Parameters

- `manager`: The location manager to specify this view as the body of.
- `isEnabled`: Whether this view should be the manager’s body.

## Discussion

Discussion @State private var locationManager = CLLocationManager()

var body: some View {     MyView()         .locationHeadingAnchor(manager: locationManager) } If more than one view specifies itself as the body of the same manager, the most recent one to do so becomes the body. Once a view stops being the body, whether because it disappeared or because isEnabled became false, the manager has no body until some view specifies one again. Use isEnabled to pick between views which are all on screen. For example, a map might anchor headings to a puck, except while navigating, when it anchors them to a vehicle icon instead: ZStack {     Puck()         .locationHeadingAnchor(manager: locationManager,                                isEnabled: !isNavigating)     VehicleIcon()         .locationHeadingAnchor(manager: locationManager,                                isEnabled: isNavigating) }
