ARView
A view that enables you to display an AR experience with RealityKit.
Declaration
@MainActor @objc @preconcurrency class ARViewMentioned in
- Handling different-sized objects in physics simulations
- Implementing postprocess effects using Metal compute functions
- Applying core image filters as a postprocess effect
- Designing scene hierarchies for efficient physics simulation
- Implementing systems for entities in a scene
- Loading remote assets in multiplayer apps
- Implementing scene understanding and reconstruction in your RealityKit app
- Using Metal performance shaders to create custom postprocess effects
Overview
Use an 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 instance that you access through the read-only scene property. To the view’s Scene instance you add one or more AnchorEntity instances that tell the view’s AR session how to tether content to something in the real world. To each anchor, you attach a hierarchy of other Entity instances that make up the content of the scene.
[Image]
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, a ModelEntity casts a grounding shadow on a physical surface by default. RealityView does not have this default behavior.
Topics
Creating a view
init(frame:)init(frame:cameraMode:automaticallyConfigureSession:)init(coder:)init(frame:cameraMode:)
Working with the scene
Configuring the AR session
Providing environmental context
Managing the camera
Finding entities at a point in the view
entity(at:)entities(at:)hitTest(_:query:mask:)hitTest(_:types:)makeRaycastQuery(from:allowing:alignment:)raycast(from:allowing:alignment:)trackedRaycast(from:allowing:alignment:updateHandler:)
Adding gesture recognizers to entities
Mapping between coordinate spaces
project(_:)unproject(_:ontoPlane:relativeToCamera:)unproject(_:ontoPlane:)unproject(_:viewport:)ray(through:)
Handling touch input
Handling keyboard input
Handling mouse input
mouseDown(with:)mouseDragged(with:)mouseUp(with:)mouseMoved(with:)rightMouseDown(with:)rightMouseDragged(with:)rightMouseUp(with:)otherMouseDown(with:)otherMouseDragged(with:)otherMouseUp(with:)scrollWheel(with:)
Managing the view
framecontentScaleFactordidMoveToSuperview()didMoveToWindow()layoutSubviews()layout()layerClassmakeBackingLayer()viewDidChangeBackingProperties()viewDidMoveToSuperview()
Taking a snapshot
Debugging the session
Structures
ARView.DebugOptionsARView.EntityGesturesARView.EnvironmentARView.PostProcessContextARView.RenderCallbacksARView.RenderOptions