how to use TMX tilemap files with SpriteKit and Swift

I wanted to make games with SpriteKit and Swift, but I found no convenient way of implementing tile maps made with the Tiled map editor. They are stored in the TMX tile map format.

There are some libraries available on GitHib that can incorporate TMX tile maps into iOS / macOS Xcode projects, but they are either incomplete or no longer maintained.

So I created my own framework and made it available to anyone who wants to use TMX tilemap files with SpriteKit and Swift. It supports iOS, macOS and tvOS.

use the PEMTileMap framework

  • get the PEMTileMap framework from GitHub
  • add it to your Xcode project
  • profit!

The repository contains an example Xcode project that shows several tilemaps.

I also made a Swift 5 version of the SuperKoalio game, which uses PEMTileMap to generate the map.