TileID

@propertyWrapper
public struct TileID

The TileIDstructure provides an interface to a masked tile id.

Tile flipping is represented by a mask of a tile global id, with the upper three bits storing orientation values (flipped horizontally, flipped vertically, flipped diagonally).

Usage

This structure is not meant to be used directly; simply passing a value to the SKTile.tileId property will set the global id and orientation of the tile.

See the Working with Tiles documentation for more information.

// A raw value of 2147483659 translates to 11, flipped horizontally.
let gid: UInt32 = 2147483659
var tileId = TileID(wrappedValue: 2147483659)
print(tileId)
// Tile ID: 11, flags: [ hFlip ]

// Alternately, we can set the flags directly:
tileId.flags = [.all]
print(tileId)
// Tile ID: 11, flags: [ hFlip, vFlip, dFlip ]

Extensions