XCode 6: How To Add Image Assets To Your Playground
As I mentioned earlier today at the Swift Hack Day, the new Playground files in XCode 6 are one of those things that I didn’t know I needed, but now can’t live without. I like to experiment in Playgrounds a lot, and that includes playing with images.
Let’s take as an example my Minion Mayhem Playground, where I create a tableView of Minions:
Each Playground comes with a Resources folder. That is where you keep your images. There are two ways to get to this Resources folder:
File Inspector
In the XCode menu just select View -> Utilities -> Show File Inspector:
You’ll see a panel on the right hand side. The Playground Settings section will have your path to the Resource folder. Just click the little arrow, and open up the Resource folder!
Now just add your images in the Resources folder, and code away!
Package Contents
The other way to get to the Resources is to right click on your Playground file in Finder, and select the Show Package Contents option:
You can now see the Resources folder:
Once you got all your images into your Resources folder, it’s time to play!