Criar programaticamente SKTileMapNode no Swift
alguém sabe como criar um SKTileMapNode programaticamente usando Swift, por favor? (OBSERVAÇÃO: não quero fazer isso usando o editor, quero fazer isso programaticamente apenas)
Eu tentei o seguinte, mas não processa meu mapa de blocos
let bgTexture = SKTexture(imageNamed: "background")
let bgDefinition = SKTileDefinition(texture: bgTexture, size: bgTexture.size())
let bgGroup = SKTileGroup(tileDefinition: bgDefinition)
let tileSet = SKTileSet(tileGroups: [bgGroup])
let bgNode = SKTileMapNode(tileSet: tileSet, columns: 5, rows: 5, tileSize: bgTexture.size())
bgNode.position = CGPoint(x: self.frame.size.width / 2, y: self.frame.size.height / 2)
bgNode.setScale(1)
self.addChild(bgNode)
Qualquer ajuda muito apreciada