didMoveToView: called every time a scene is presented by SKView. Pros of positioning and adding sprites in didMoveToView: you can initialize many views without capturing a lot of memory. Cons: If you delete the view and then add it again, then makeMoveToView: called again. This means that you need to be sure to reset your scene at the beginning of didMoveToView: (only if you intend to delete and add again).
init is called when SKScene is initialized. Advantages of using init to position and add sprites: it is called only once, and everything will be ready when you present it on stage. If you need to preload scenes for quick switching, this can be convenient. Cons: each scene will take up the memory needed to perform all sprite additions during initialization, and not when it is displayed.
Personally, I prefer to do everything in the init method.
Theis egeberg
source share