Class

SKView

An object that displays SpriteKit content. This content is provided by an SKScene object.

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 isPaused property to true.

Topics

Presenting Scenes

func presentScene(SKScene, transition: SKTransition)

Transitions from the current scene to a new scene.

var scene: SKScene?

The scene currently presented by the view.

Configuring How a Scene Is Rendered

var isAsynchronous: Bool

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

var frameInterval: Int

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

Deprecated
var allowsTransparency: Bool

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

var ignoresSiblingOrder: Bool

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

var shouldCullNonVisibleNodes: Bool

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

Pausing the Scene’s Simulation

var isPaused: Bool

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

Displaying Debugging Information

var showsFPS: Bool

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

var showsQuadCount: Bool

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

var showsDrawCount: Bool

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

var showsNodeCount: Bool

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

var showsPhysics: Bool

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

var showsFields: Bool

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

Converting Between View and Scene Coordinates

func convert(CGPoint, from: SKScene)

Converts a point from scene coordinates to view coordinates.

func convert(CGPoint, to: SKScene)

Converts a point from view coordinates to scene coordinates.

Obtaining Textures from Scene Content

func texture(from: SKNode, crop: CGRect)

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

func texture(from: SKNode)

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

Instance Properties

var delegate: SKViewDelegate?

A delegate to be called during before rendering.

var preferredFramesPerSecond: Int

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

See Also

Displaying SpriteKit Content in Your App

class SKScene

The root node for all Sprite Kit objects displayed in a view.

class SKNode

The SKNode class is the fundamental building block of most SpriteKit content.

protocol SKViewDelegate

Methods that allow dynamic control of an SKView object's render rate.

protocol SKSceneDelegate

Methods your app can implement to participate in SpriteKit's animation loop.