Organizing your assets

We will quickly overrun our project navigator with image files if we add all our textures as we did with our bee. Luckily, Xcode provides several solutions.

Exploring Images.xcassets

We can store images in an .xcassets file and refer to them easily from our code. This is a good place for our background images:

  1. Open Images.xcassets from your project navigator.
  2. We do not need to add any images here now but, in the future, you can drag image files directly into the image list, or right-click, then Import.
  3. Notice that the SpriteKit demo's spaceship image is stored here. We do not need it anymore, so we can right-click on it and choose Removed Selected Items to delete it.

Collecting art into texture atlases

We will use texture atlases ...

Get Game Development with Swift now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.