A two-dimensional array of images.
- iOS 10.0+
- macOS 10.12+
- Mac Catalyst 13.0+
- tvOS 10.0+
- watchOS 3.0+
SKTile does the work of laying out predefined tiles in a grid of any size. Typically, you configure 9-slice images (tile groups) in Xcode's SpriteKit scene editor and paint the look of your tile map ahead of time versus configuring the tile map in code.
As with sprite nodes, you can layer tile maps with different blend modes or control it with actions and physics, for example, for the purpose of parallax scrolling. The rendered tile map can be post processed with an
SKShader to add effects such as motion blur or atmospheric perspective.
To work with a tile map programmatically, you supply
SKTile with a tile set that defines the tile definitions it can render. Then, fill each tile in the tile map with the
fill(with:) method and set individual tiles with