Type Method

preloadTextures:withCompletionHandler:

Load the data of multiple textures into memory.

Declaration

+ (void)preloadTextures:(NSArray<SKTexture *> *)textures withCompletionHandler:(void (^)(void))completionHandler;

Parameters

textures

An array of SKTexture objects.

completionHandler

A block called after all of the textures are loaded.

Discussion

SpriteKit creates a background task that loads the texture data for all of the textures in the array, then returns control to your game. Your completion handler is called after all of the textures are loaded.

See Also

Preloading a Texture for Performance

Preloading Textures into Memory

Decompress images ahead of time to avoid performance issues during gameplay.

- preloadWithCompletionHandler:

Load texture data into memory, calling a completion handler after the task completes.