<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: -",
    "watchOS: 7.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NearbyInteraction",
  "identifier" : "/documentation/NearbyInteraction/NINearbyObject/direction-4qh5w",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Nearby Interaction",
      "NearbyInteraction"
    ],
    "preciseIdentifier" : "s:So14NINearbyObjectC17NearbyInteractionE9directions5SIMD3VySfGSgvp"
  },
  "title" : "direction"
}
-->

# direction

A vector that points from the user’s device in the direction of the peer device.

```
var direction: simd_float3? { get }
```

## Discussion

This property is `nil` when direction is unavailable, such as when the app runs on Apple Watch.

On iPhone, it’s possible to recieve direction for nearby third-party accessories in sessions that enable [`isCameraAssistanceEnabled`](/documentation/NearbyInteraction/NINearbyPeerConfiguration/isCameraAssistanceEnabled).

### Interpret Direction

This property is a Cartesian triplet (x,y,z) in normalized units with a range of `[0..1]`. Nearby Interaction models [`direction`](/documentation/NearbyInteraction/NINearbyObject/direction-4qh5w) as a coordinate on a sphere, such that a ray cast from the sphere’s center through the coordinate points toward the peer device. For each axis, the sphere center is at coordinate 0, and the surface is at coordinate 1. As the user looks at the device’s screen,

- The x-axis extends positively to the right.
- The y-axis extends positively upward.
- The z-axis extends negatively from the device’s center, away from the user.

The following figure illustrates the direction-vector coordinate space from two different angles.

![A diagram of a phone in two different orientations, each with a coordinate system that renders from an origin in the middle of the device. The phone on the left shows the back of the phone, with an up-axis labeled “+y”. Its horizontal axis points left, and is labeled “+x”. Its z-axis points toward the reader, and is labeled “-z”. The phone on the right faces toward the reader, with an up-axis labeled “+y”. Its horizontal axis points right and is labeled “+x”. Its z-axis points away from the reader, and is labeled “-z”.](images/com.apple.nearbyinteraction/media-3798530@2x.png)

For more information, see [Initiating and maintaining a session](/documentation/NearbyInteraction/initiating-and-maintaining-a-session).

---

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)