Gh0st Gh0st - 4 months ago 144
Swift Question

cannot convert value of type UIImage to expected argument type string

I have some problem with swift.

Ground = SKSpriteNode(imageNamed: "#imageLiteral(resourceName: "Ground")")


Here it says "cannot convert value of type UIImage to expected argument type string" how can i fix this

Answer

Maybe I'm missing something but why are you adding this?

#imageLiteral(resourceName: 

The correct syntax is

let ground = SKSpriteNode(imageNamed: "Ground")
Comments