Sprite Kit performs memory management very well. When a texture is needed to be rendered in scene, but is not prepared, Sprite Kit loads it into memory, and uploads it to the graphics hardware by converting it to a usable form. If many unloaded textures are needed at once, it might slow down the game. To avoid this, we need to preload textures before using them, especially in larger or more complex games.
This problem may arise when a user has to go from the level screen to the game screen. As the game screen may have many textures, it will need to load and might be slow due to the loading of texture. To avoid this, we can use the SKTexture class preloadTextures(_:withCompletionHandler:)
function. It takes an array of SKTexture and a block, which is called after all the texture is loaded. So, we can use this block to load a scene.
For a small game, we can load all the textures at once, at game launch time. For a larger game, we will need to split the textures...