Contents

init(texture:size:)

Initializes a textured sprite using an existing texture object but with a specified size.

Declaration

convenience init(texture: SKTexture?, size: CGSize)

Parameters

  • texture:

    A SpriteKit texture.

  • size:

    The size of the sprite in points.

Return Value

A newly initialized sprite object.

Discussion

The sprite is initialized using the texture, but the texture’s dimensions are not used. Instead, the size passed into the constructor method is used.

See Also

Creating a Sprite from a Texture