Frode
Frode

Reputation: 503

How do I create an empty SKSpriteNode in Swift?

How do I create an empty SKSpriteNode in Swift? I need a SKSpriteNode which I can add SKSpriteNode

children to.

The equivalent of this in Objective-C:

SKSpriteNode *textSprite = [SKSpriteNode new];

Upvotes: 1

Views: 2069

Answers (2)

Groot
Groot

Reputation: 14261

Let type inference do the work of figuring out the type:

var textSprite = SKSpriteNode()

Upvotes: 2

Mike_NotGuilty
Mike_NotGuilty

Reputation: 2405

var textSprite: SKSpriteNode = SKSpriteNode()

Upvotes: 1

Related Questions