<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ARView",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "c:@M@RealityKit@objc(cs)ARView"
  },
  "title" : "ARView"
}
-->

# ARView

A view that enables you to display an AR experience with RealityKit.

```
@MainActor @objc @preconcurrency class ARView
```

## Overview

Use an [`ARView`](/documentation/RealityKit/ARView) instance to display rendered 3D graphics to the user. You
typically add a single view to your app’s storyboard, and then provide an
outlet for that view in your code. Alternatively, you can create and add a
view to your view hierarchy programmatically at runtime, as you would any
other view.

A view has a single [`Scene`](/documentation/RealityKit/Scene) instance that you access through the read-only
[`scene`](/documentation/RealityKit/ARView/scene) property. To the view’s [`Scene`](/documentation/RealityKit/Scene) instance you add one or
more [`AnchorEntity`](/documentation/RealityKit/AnchorEntity) instances that tell the view’s AR [`session`](/documentation/RealityKit/ARView/session)
how to tether content to something in the real world. To each anchor, you
attach a hierarchy of other [`Entity`](/documentation/RealityKit/Entity) instances that make up the content of
the scene.

![Block diagram highlighting the AR view as the root object that you](images/com.apple.RealityKit/ARView-1@2x.png)

Additionally, you can use the view to:

- Configure render options, environmental characteristics, and the camera
  mode.
- Handle platform-appropriate user interaction in the form of mouse,
  keyboard, or gesture input.
- Find entities at a given point in the view.
- Access statistics and visualizations that help you debug your app.

Note that with [`ARView`](/documentation/RealityKit/ARView), a [`ModelEntity`](/documentation/RealityKit/ModelEntity) casts a grounding shadow on
a physical surface by default.  [`RealityView`](/documentation/RealityKit/RealityView) does not have this default
behavior.

## Topics

### Creating a view

[`init(frame:)`](/documentation/RealityKit/ARView/init(frame:))

Creates an AR view with the specified dimensions.

[`init(frame:cameraMode:automaticallyConfigureSession:)`](/documentation/RealityKit/ARView/init(frame:cameraMode:automaticallyConfigureSession:))

Creates an AR view with the specified dimensions, camera mode, and
session configuration state.

[`init(coder:)`](/documentation/RealityKit/ARView/init(coder:))

Creates an AR view initialized from data in a given decoder.

[`init(frame:cameraMode:)`](/documentation/RealityKit/ARView/init(frame:cameraMode:))

Creates an AR view with the specified dimensions and camera mode.

### Working with the scene

[`scene`](/documentation/RealityKit/ARView/scene)

The scene that the view renders and simulates.

### Configuring the AR session

[`session`](/documentation/RealityKit/ARView/session)

The AR session that supports the view’s rendering.

[`automaticallyConfigureSession`](/documentation/RealityKit/ARView/automaticallyConfigureSession)

An indication of whether to use an automatically configured AR session.

[`renderOptions`](/documentation/RealityKit/ARView/renderOptions-swift.property)

The render options that configure the view’s AR session.

[`renderCallbacks`](/documentation/RealityKit/ARView/renderCallbacks-swift.property)

A container that holds the view’s render callbacks.

### Providing environmental context

[`environment`](/documentation/RealityKit/ARView/environment-swift.property)

The view’s background, lighting, and acoustic properties.

[`physicsOrigin`](/documentation/RealityKit/ARView/physicsOrigin)

The entity that defines the origin of the scene’s physics simulation.

[`audioListener`](/documentation/RealityKit/ARView/audioListener)

The entity that defines the listener position and orientation for
spatial audio.

### Managing the camera

[`cameraMode`](/documentation/RealityKit/ARView/cameraMode-swift.property)

A setting that chooses between the AR session’s camera and a virtual
one.

[`cameraTransform`](/documentation/RealityKit/ARView/cameraTransform)

The transform of the currently active camera.

### Finding entities at a point in the view

[`entity(at:)`](/documentation/RealityKit/ARView/entity(at:))

Finds the entity in the AR scene closest to the specified point.

[`entities(at:)`](/documentation/RealityKit/ARView/entities(at:))

Finds the collection of entities at the specified point in the scene.

[`hitTest(_:query:mask:)`](/documentation/RealityKit/ARView/hitTest(_:query:mask:))

Searches for objects corresponding to a point in the view based on a
query and a collision mask.

[`hitTest(_:types:)`](/documentation/RealityKit/ARView/hitTest(_:types:))

Searches for objects corresponding to a point in the view based on a set
of result types.

[`makeRaycastQuery(from:allowing:alignment:)`](/documentation/RealityKit/ARView/makeRaycastQuery(from:allowing:alignment:))

Creates a ray-cast query originating from a point in the view, centered
on the camera’s field of view.

[`raycast(from:allowing:alignment:)`](/documentation/RealityKit/ARView/raycast(from:allowing:alignment:))

Performs a ray cast, where a ray is cast into the scene from the center
of the camera through a point in the view, and the results are
immediately returned.

[`trackedRaycast(from:allowing:alignment:updateHandler:)`](/documentation/RealityKit/ARView/trackedRaycast(from:allowing:alignment:updateHandler:))

Performs a tracked ray cast, where a ray is cast into the scene from the
center of the camera through a point in the view.

### Adding gesture recognizers to entities

[`installGestures(_:for:)`](/documentation/RealityKit/ARView/installGestures(_:for:))

Installs standard gestures onto the given entity, configured to be
recognized simultaneously.

[`gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:)`](/documentation/RealityKit/ARView/gestureRecognizer(_:shouldRecognizeSimultaneouslyWith:))

### Mapping between coordinate spaces

[`project(_:)`](/documentation/RealityKit/ARView/project(_:))

Projects a point from the 3D world coordinate system of the scene to the
2D pixel coordinate system of the view.

[`unproject(_:ontoPlane:relativeToCamera:)`](/documentation/RealityKit/ARView/unproject(_:ontoPlane:relativeToCamera:))

Unproject a 2D point from the view onto a plane in 3D world coordinates.

[`unproject(_:ontoPlane:)`](/documentation/RealityKit/ARView/unproject(_:ontoPlane:))

Maps a 2D point from the view’s coordinate system onto the given plane
in 3D space.

[`unproject(_:viewport:)`](/documentation/RealityKit/ARView/unproject(_:viewport:))

Maps a 2D point from the pixel coordinate system of a viewport into a 3D
coordinate space. The point lies on this view’s near clipping plane.

[`ray(through:)`](/documentation/RealityKit/ARView/ray(through:))

Determines the position and direction of a ray through the given point
in the 2D space of the view.

### Handling touch input

[`touchesBegan(_:with:)`](/documentation/RealityKit/ARView/touchesBegan(_:with:))

Tells the view that one or more new touches occurred.

[`touchesMoved(_:with:)`](/documentation/RealityKit/ARView/touchesMoved(_:with:))

Tells the view when one or more touches associated with an event
changed.

[`touchesEnded(_:with:)`](/documentation/RealityKit/ARView/touchesEnded(_:with:))

Tells the view when one or more fingers are raised from the view.

[`touchesCancelled(_:with:)`](/documentation/RealityKit/ARView/touchesCancelled(_:with:))

Tells the view when a system event (such as a system alert) cancels a
touch sequence.

### Handling keyboard input

[`acceptsFirstResponder`](/documentation/RealityKit/ARView/acceptsFirstResponder)

A Boolean value that indicates whether the view accepts first responder
status.

[`keyDown(with:)`](/documentation/RealityKit/ARView/keyDown(with:))

Informs the view that the user has pressed a key.

[`keyUp(with:)`](/documentation/RealityKit/ARView/keyUp(with:))

Informs the view that the user has released a key.

### Handling mouse input

[`mouseDown(with:)`](/documentation/RealityKit/ARView/mouseDown(with:))

Informs the view that the user has pressed the left mouse button.

[`mouseDragged(with:)`](/documentation/RealityKit/ARView/mouseDragged(with:))

Informs the view that the user has moved the mouse with the left button
pressed.

[`mouseUp(with:)`](/documentation/RealityKit/ARView/mouseUp(with:))

Informs the view that the user has released the left mouse button.

[`mouseMoved(with:)`](/documentation/RealityKit/ARView/mouseMoved(with:))

Informs the view that the mouse has moved.

[`rightMouseDown(with:)`](/documentation/RealityKit/ARView/rightMouseDown(with:))

Informs the view that the user has pressed the right mouse button.

[`rightMouseDragged(with:)`](/documentation/RealityKit/ARView/rightMouseDragged(with:))

Informs the view that the user has moved the mouse with the right button
pressed.

[`rightMouseUp(with:)`](/documentation/RealityKit/ARView/rightMouseUp(with:))

Informs the view that the user has released the right mouse button.

[`otherMouseDown(with:)`](/documentation/RealityKit/ARView/otherMouseDown(with:))

Informs the view that the user has pressed a mouse button other than the
left or right one.

[`otherMouseDragged(with:)`](/documentation/RealityKit/ARView/otherMouseDragged(with:))

Informs the view that the user has moved the mouse with a button other
than the left or right button pressed.

[`otherMouseUp(with:)`](/documentation/RealityKit/ARView/otherMouseUp(with:))

Informs the view that the user has released a mouse button other than
the left or right button.

[`scrollWheel(with:)`](/documentation/RealityKit/ARView/scrollWheel(with:))

Informs the view that the mouse’s scroll wheel has moved.

### Managing the view

[`frame`](/documentation/RealityKit/ARView/frame)

The frame rectangle, which describes the view’s location and size in the
coordinate system of the view’s superview.

[`contentScaleFactor`](/documentation/RealityKit/ARView/contentScaleFactor)

The scale factor of the content in the view.

[`didMoveToSuperview()`](/documentation/RealityKit/ARView/didMoveToSuperview())

Tells the view that its superview changed.

[`didMoveToWindow()`](/documentation/RealityKit/ARView/didMoveToWindow())

Tells the view that its window property is set to a new value.

[`layoutSubviews()`](/documentation/RealityKit/ARView/layoutSubviews())

Lays out subviews.

[`layout()`](/documentation/RealityKit/ARView/layout())

[`layerClass`](/documentation/RealityKit/ARView/layerClass)

The class used to create the layer for view instances.

[`makeBackingLayer()`](/documentation/RealityKit/ARView/makeBackingLayer())

Creates the view’s backing layer.

[`viewDidChangeBackingProperties()`](/documentation/RealityKit/ARView/viewDidChangeBackingProperties())

Tells the view when its backing store properties change.

[`viewDidMoveToSuperview()`](/documentation/RealityKit/ARView/viewDidMoveToSuperview())

Tells the view that it has a new superview or that the view’s superview
has been removed.

### Taking a snapshot

[`snapshot(saveToHDR:completion:)`](/documentation/RealityKit/ARView/snapshot(saveToHDR:completion:)-66jzu)

Takes a screenshot.

[`snapshot(saveToHDR:completion:)`](/documentation/RealityKit/ARView/snapshot(saveToHDR:completion:)-91ifk)

Takes a screenshot.

[`ARView.Image`](/documentation/RealityKit/ARView/Image)

### Debugging the session

[Improving the Performance of a RealityKit App](/documentation/RealityKit/improving-the-performance-of-a-realitykit-app)

Measure CPU and GPU utilization to find ways to improve your app’s performance.

[`debugOptions`](/documentation/RealityKit/ARView/debugOptions-swift.property)

The current debugging options.



---

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)