---
title: ARAnchor
framework: arkit
role: symbol
role_heading: Class
path: arkit/aranchor
---

# ARAnchor

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

## Declaration

```swift
class ARAnchor
```

## Mentioned in

Displaying an AR Experience with Metal Providing 2D Virtual Content with SpriteKit Providing 3D Virtual Content with SceneKit

## Overview

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:) 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, ARObjectAnchor, and ARImageAnchor objects if you enable the corresponding features; face-tracking sessions add 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: Anchor subclasses must fullfill the requirements of the ARAnchorCopying protocol. ARKit calls init(anchor:) (on a background thread) to copy instances of your anchor class from each 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 NSSecureCoding protocol. Override encode(with:) and 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 property. Only anchors that do not adopt ARTrackable are included when you save a world map.

## Topics

### Creating Anchors

- [init(transform:)](arkit/aranchor/init(transform:).md)
- [init(name:transform:)](arkit/aranchor/init(name:transform:).md)
- [name](arkit/aranchor/name.md)

### Tracking Anchors

- [identifier](arkit/aranchor/identifier.md)
- [sessionIdentifier](arkit/aranchor/sessionidentifier.md)
- [transform](arkit/aranchor/transform.md)

### Initializers

- [init(anchor:)](arkit/aranchor/init(anchor:).md)
- [init(coder:)](arkit/aranchor/init(coder:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [ARAppClipCodeAnchor](arkit/arappclipcodeanchor.md)
- [ARBodyAnchor](arkit/arbodyanchor.md)
- [AREnvironmentProbeAnchor](arkit/arenvironmentprobeanchor.md)
- [ARFaceAnchor](arkit/arfaceanchor.md)
- [ARGeoAnchor](arkit/argeoanchor.md)
- [ARImageAnchor](arkit/arimageanchor.md)
- [ARMeshAnchor](arkit/armeshanchor.md)
- [ARObjectAnchor](arkit/arobjectanchor.md)
- [ARParticipantAnchor](arkit/arparticipantanchor.md)
- [ARPlaneAnchor](arkit/arplaneanchor.md)

### Conforms To

- [ARAnchorCopying](arkit/aranchorcopying.md)
- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### iOS

- [Verifying Device Support and User Permission](arkit/verifying-device-support-and-user-permission.md)
- [ARSession](arkit/arsession.md)
- [ARKit in iOS](arkit/arkit-in-ios.md)
