Class

SKView

A view subclass that renders a SpriteKit scene.

Declaration

iOS, tvOS
@interface SKView : UIView
macOS
@interface SKView : NSView

Overview

You present a scene by calling the view’s presentScene: method. When a scene is presented by the view, it alternates between running its simulation (which animates the content) and rendering the content for display. You can pause the scene by setting the view’s paused property to YES.

Topics

Displaying a Scene

Present a scene to display content on the screen.

scene

The scene currently presented by this view.

- presentScene:

Presents a scene.

- presentScene:transition:

Transitions from the current scene to a new scene.

SKTransition

An object used to perform an animated transition to a new scene.

Controlling the Timing of a Scene's Rendering

Control the timing of the view's screen updates.

paused

A Boolean value that indicates whether the view’s scene animations are paused.

preferredFramesPerSecond

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

delegate

A delegate that allows dynamic control of the view's render rate.

SKViewDelegate

Methods to take custom control over the view's render rate.

frameInterval

The number of frames that must pass before the scene is called to update its contents.

Deprecated

Configuring Performance Related Toggles

Control hints that have performance implications which are unique to your app.

ignoresSiblingOrder

A Boolean value that indicates whether parent-child and sibling relationships affect the rendering order of nodes in the scene.

shouldCullNonVisibleNodes

A Boolean value that indicates whether the view automatically culls non-visible nodes from the rendering tree.

allowsTransparency

A Boolean property that indicates whether the view is rendered using transparency.

asynchronous

A Boolean value that indicates whether the content is rendered asynchronously.

Enabling Visual Statistics for Debugging

Display metrics in the bottom corner of the view for debugging purposes.

showsFPS

A Boolean value that indicates whether the view displays a frame rate indicator.

showsNodeCount

A Boolean value that indicates whether the view displays an overlay that shows physics bodies that are visible in the scene.

showsDrawCount

A Boolean value that indicates whether the view displays the number of drawing passes it needed to render the view.

showsQuadCount

A Boolean value that indicates whether the view displays the number of rectangles used to render the scene.

showsPhysics

A Boolean value that indicates whether the view displays physics-related debugging information.

showsFields

A Boolean value that indicates whether the view displays information about physics fields in the scene.

Converting Between View and Scene Coordinates

Convert to or from scene and view coordinates which is a common task for touch or mouse input.

- convertPoint:fromScene:

Converts a point from scene coordinates to view coordinates.

- convertPoint:toScene:

Converts a point from view coordinates to scene coordinates.

Snapshotting Nodes to a Texture

Create a texture that is a flattened or cropped portion of the node heirarchy.

- textureFromNode:crop:

Renders a portion of a node’s contents and returns the rendered image as a texture.

- textureFromNode:

Renders the contents of a node tree and returns the rendered image as a texture.

Creating a New Node By Rendering To a Texture

Render a portion of the node tree into a new texture.

Switching Renderers

Requesting the OpenGL Renderer

Switch to the legacy renderer temporarily for debugging purposes.

Relationships

Inherits From

Conforms To

See Also

Scene Renderers

Choosing a SpriteKit Scene Renderer

Compare the different ways to display a SpriteKit scene.

SKRenderer

An object that renders a scene into a custom Metal rendering pipeline and drives the scene update cycle.

WKInterfaceSKScene

A visual WatchKit element that displays a SpriteKit scene.