Class

SCNView

A view for displaying 3D SceneKit content.

Declaration

iOS, Mac Catalyst, tvOS
@interface SCNView : UIView
macOS
@interface SCNView : NSView

Overview

In macOS, SCNView is a subclass of NSView. In iOS and tvOS, SCNView is a subclass of UIView. As part of either operating system’s view hierarchy, an SCNView object provides a place for SceneKit content in your app’s user interface. You can create a SceneKit view by using its initWithFrame:options: method or by adding it to a nib file or storyboard. To provide content for a SceneKit view, assign an SCNScene object to its scene property.

For additional important methods and properties for working with SceneKit views, see the SCNSceneRenderer protocol. (You can also render SceneKit content into an arbitrary Metal command queue or OpenGL context using the SCNRenderer class, or into a Core Animation layer on macOS using the SCNLayer class. The SCNSceneRenderer protocol defines functionality common to all three SceneKit rendering classes.)

Topics

Initializing a SceneKit View

- initWithFrame:options:

Initializes and returns a newly allocated SceneKit view object with the specified frame rectangle and options.

SCNViewOption

Dictionary keys specifying initialization options, used when initializing a SceneKit view.

Specifying a Scene

scene

The scene to be displayed in the view.

Configuring a View

backgroundColor

The background color of the view.

preferredFramesPerSecond

The animation frame rate that the view uses to render its scene.

rendersContinuously

A Boolean value that determines whether the view always renders at its preferred frame rate or only when its visible content changes.

antialiasingMode

The antialiasing mode used for rendering the view’s scene.

SCNAntialiasingMode

Modes for antialiased rendering of the view’s scene, used by the SCNView property.

Managing Camera Controls

allowsCameraControl

A Boolean value that determines whether the user can manipulate the current point of view that is used to render the scene.

cameraControlConfiguration

The current configuration for the camera controller's event-handling behavior.

SCNCameraControlConfiguration

Properties affecting the behavior of a camera controller.

Playing Action and Animation in a View’s Scene

- pause:

Pauses playback of the view’s scene.

- play:

Resumes playback of the view’s scene.

- stop:

Stops playback of the view’s scene and resets the scene time to its start time.

Capturing a View Snapshot

- snapshot

Renders the view’s scene into a new image object.

Working with a View’s OpenGL ES Context

eaglContext

The OpenGL ES context that the view uses to render its contents.

Deprecated

Working with a View’s OpenGL Context

openGLContext

The OpenGL context that the view uses to render its contents.

Deprecated
pixelFormat

The view’s OpenGL pixel format.

Deprecated

Relationships

Inherits From

See Also

First Steps

SCNScene

A container for the node hierarchy and global properties that together form a displayable 3D scene.