When trying to remove the suffix from a filename
, I'm only left with the suffix, which is exactly not what I want.
What (how many things) am I doing wrong here:
let myTextureAtlas = SKTextureAtlas(named: "demoArt")
let filename = (myTextureAtlas.textureNames.first?.characters.split{$0 == "."}.map(String.init)[1].replacingOccurrences(of: "\'", with: ""))! as String
print(filename)
This prints png
which is the most dull part of the whole thing.
map(String.init)[0]
pass subscript 0 instead of 1, or usefirst?
directlymap(String.init).first?