<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ARKit",
  "identifier" : "/documentation/ARKit/ARAnchor",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ARKit"
    ],
    "preciseIdentifier" : "c:objc(cs)ARAnchor"
  },
  "title" : "ARAnchor"
}
-->

# ARAnchor

An object that specifies the position and orientation of an item in the physical environment.

```
class ARAnchor
```

## Overview

To track the static positions and orientations of real or virtual objects relative to the camera, create anchor objects and use the [`add(anchor:)`](/documentation/ARKit/ARSession/add(anchor:)) method to add them to your AR session.

> Tip:
> Adding an anchor to the session helps ARKit to optimize world-tracking accuracy in the area around that anchor, so that virtual objects appear to stay in place relative to the real world. If a virtual object moves, remove the corresponding anchor from the old position and add one at the new position.

Some ARKit features automatically add special anchors to a session. World-tracking sessions can add [`ARPlaneAnchor`](/documentation/ARKit/ARPlaneAnchor), [`ARObjectAnchor`](/documentation/ARKit/ARObjectAnchor), and [`ARImageAnchor`](/documentation/ARKit/ARImageAnchor) objects if you enable the corresponding features; face-tracking sessions add [`ARFaceAnchor`](/documentation/ARKit/ARFaceAnchor) objects.

### Subclassing Notes

In addition to creating your own `ARAnchor` instances to track the real-world positions of your virtual content, you can also subclass `ARAnchor` to associate custom data with anchors you create. Ensure that your anchor classes behave correctly when ARKit updates frames or saves and loads anchors in an [`ARWorldMap`](/documentation/ARKit/ARWorldMap):

- Anchor subclasses must fullfill the requirements of the [`ARAnchorCopying`](/documentation/ARKit/ARAnchorCopying) protocol. ARKit calls [`init(anchor:)`](/documentation/ARKit/ARAnchorCopying/init(anchor:)) (on a background thread) to copy instances of your anchor class from each [`ARFrame`](/documentation/ARKit/ARFrame) to the next. Your implementation of this initializer should copy the values of any custom properties your subclass adds.
- Anchor subclasses must also adopt the <doc://com.apple.documentation/documentation/Foundation/NSSecureCoding> protocol. Override <doc://com.apple.documentation/documentation/Foundation/NSCoding/encode(with:)> and <doc://com.apple.documentation/documentation/Foundation/NSCoding/init(coder:)> to save and restore the values your subclass’ custom properties when ARKit saves and loads them in a world map.
- Anchors are considered equal based on their [`identifier`](/documentation/ARKit/ARAnchor/identifier) property.
- Only anchors that do not adopt [`ARTrackable`](/documentation/ARKit/ARTrackable) are included when you save a world map.

## Topics

### Creating Anchors

[`-  initWithTransform:`](/documentation/ARKit/ARAnchor/init(transform:))

Creates a new anchor object with the specified transform.

[`-  initWithName:transform:`](/documentation/ARKit/ARAnchor/init(name:transform:))

Creates a new anchor object with the specified transform and a descriptive name.

[`name`](/documentation/ARKit/ARAnchor/name)

A descriptive name for the anchor.

### Tracking Anchors

[`identifier`](/documentation/ARKit/ARAnchor/identifier)

A unique identifier for the anchor.

[`sessionIdentifier`](/documentation/ARKit/ARAnchor/sessionIdentifier)

The unique identifier of the session that owns this anchor.

[`transform`](/documentation/ARKit/ARAnchor/transform)

A matrix encoding the position, orientation, and scale of the anchor relative to the world coordinate space of the AR session the anchor is placed in.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

[`ARAnchorCopying`](/documentation/ARKit/ARAnchorCopying)

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

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

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

### Inherited By

[`ARPlaneAnchor`](/documentation/ARKit/ARPlaneAnchor)

[`ARGeoAnchor`](/documentation/ARKit/ARGeoAnchor)

[`ARAppClipCodeAnchor`](/documentation/ARKit/ARAppClipCodeAnchor)

[`AREnvironmentProbeAnchor`](/documentation/ARKit/AREnvironmentProbeAnchor)

[`ARFaceAnchor`](/documentation/ARKit/ARFaceAnchor)

[`ARMeshAnchor`](/documentation/ARKit/ARMeshAnchor)

[`ARParticipantAnchor`](/documentation/ARKit/ARParticipantAnchor)

[`ARImageAnchor`](/documentation/ARKit/ARImageAnchor)

[`ARObjectAnchor`](/documentation/ARKit/ARObjectAnchor)

[`ARBodyAnchor`](/documentation/ARKit/ARBodyAnchor)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)