Gh0st Gh0st - 1 year ago 403
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 Source

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

#imageLiteral(resourceName: 

The correct syntax is

let ground = SKSpriteNode(imageNamed: "Ground")