Instance Property


The dimensions of the scene, in points.


var size: CGSize { get set }


When a scene is first initialized, its size property is configured by the designated initializer. The size of the scene specifies the size of the visible portion of the scene in points. This is only used to specify the visible portion of the scene. Nodes in the tree can be positioned outside of this area; those nodes are still processed by the scene, but are ignored by the renderer.

When a scene is presented, the size and anchorPoint properties determine the portion of the scene’s coordinate space that is visible in the view.

If you set the size property to a new value, the scene’s didChangeSize(_:) method is called. This property can also change if the scaleMode property is set to SKSceneScaleMode.resizeFill and the presenting view is resized. After the scene’s size changes, future updates are rendered immediately at the new size.

See Also

Creating a Scene Programmatically

init(size: CGSize)

Initializes a new scene object.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software