Can't load a texture atlas on a Swift playground?

Well, in the past I loaded SKTextureAtlas into my class just by typing its name, however now on Swift playgrounds I tried to add several extensions (.atlas, .spriteatlas, no extension ..) and everything else, however I get an error message:

Texture Atlas 'testAtlas' cannot be found.

Here is how I get it:

override init(texture: SKTexture!, color: NSColor!, size: CGSize) {
        super.init(texture: texture, color: color, size: size)

        atlas = SKTextureAtlas(named: "testAtlas")
        print(atlas.textureNames) //to test if got it
    }

I think this is a problem with the fact that they are not a goal on the playground, but I put it in the resources folder and it should recognize the atlas:

enter image description here

How can I get a texture atlas on playgrounds with Swift 3?

+4
source share

Source: https://habr.com/ru/post/1673196/


All Articles