Configure an AR session and use SceneKit or SpriteKit to display AR content.
When you use the
ARSKView class, ARKit automatically manages the basic requirements for creating an AR experience: Each view displays a live camera image as its backdrop and renders the 2D or 3D overlay content you provide to create the illusion of that content inhabiting the real world. To use one of these view classes, you configure it for the kind of AR experience you want to create, and choose positions and representations for your overlay content.
To build your own view for an AR experience instead, see Displaying an AR Experience with Metal.
Configure and Run the AR Session
ARSKView classes include an
ARSession object that manages the motion tracking and image processing required to create an AR experience. However, to run a session you must provide a session configuration.
ARWorld class provides high-precision motion tracking and enables features to help you place virtual content in relation to real-world surfaces. In situations where world tracking is not available, the base class
ARSession provides simple motion tracking that permits less immersive AR experiences.To start an AR session, create a session configuration object with the options you want, then call the
run(_: method on the
session object of your
After you’ve set up your AR session, use SceneKit or SpriteKit to place virtual content in the view.