How do I add an image in Playgrounds for iPad?

I'm using playgrounds for iPad, and I'm trying to add an image to a SpriteKit node (I.e. I have SKSpriteNode(imageNamed: )). How do I add an image? I'even tired using the "plus" button in the top-right-hand corner, adding an image, and then inserting the image in my code, but I get the error "cannot convert value of type 'UIImage' to expected argument type 'String'). So, how do I point to an image? Thanks!

Doing that is really simple! Let me show you how 🙂


let image = SKSpriteNode(texture: SKTexture(image: (YOUR IMAGE HERE")

That's it! I hope I was able to help you out! Have fun coding!

How do I add an image in Playgrounds for iPad?
 
 
Q