Reputation: 632
So, I have a SKScene in swift that I want to completely erase, as in remove all sprites so I can redraw it from scratch. Is there a built in method for this?
Upvotes: 1
Views: 273
Reputation: 3949
If you want to restart from scratch, you can use Initialization to achieve this as stated by the Swift Documentation:
Initialization is the process of preparing an instance of a class, structure, or enumeration for use.
myScene = MySceneClass(someSize)
Or, if you don't need to restart from start, create a reset method that reset only what you want to reset.
At last, if your need is to remove all the sprites then use removeAllChildren()
.
Upvotes: 1