How to I call SKTileSet init(named:) in objective C?

59 views Asked by At

I was able to create an SKTileSet on xcode but it seems like I am having a difficult time being able to init an SKTileSet with passing through a name like here:

https://developer.apple.com/documentation/spritekit/sktileset/1643819-init

This would be great to save a lot of time programmatically creating the whole set, group, rules and etc...

Thank you!

1

There are 1 answers

0
Maetschl On

You have to use the name inside the .sks file for tileSetNamed

With this setup for example:

enter image description here

You should use:

Objective-C

SKTileSet *tileSet = [SKTileSet tileSetNamed:@"Sample Tile Set"];

or Swift 5

let tileSet = SKTileSet(named: "Sample Tile Set")