Swift: Resolving Asset Catalog Compiler Warning

Fun thing happened the other day as I created a project to test out some code in XCode, I had initially set it to iPhone only by mistake then went back to set the app to Universal, only to encounter two warnings that had me puzzled as to how to resolve it. This isn’t a coding issue so much as an XCode thing as these were the warnings:

acata01

Having heard from Simon Allardice that warnings are not to be ignored, but addressed, I went to look in the Asset Catalog. Specifically the app icon that was throwing the warnings and was unhelpfully presented with this:

acata02

Where’s the 76×76 icon and why is it throwing me an warning about it? Turns out, XCode hides certain sizes of app icons that aren’t initially set upon project setup. To get those additional icon sizes, you need to display them by going through the utilities tab. Here’s how to do this:

1. Go to your Images.xcassets catalog.
2a. To the right, click on the Attributes Inspector icon. It looks like this for those ultra new to XCode:

2b. It’s tiny so you can easily miss it if you don’t recognize it. Look for it in the upper right corner of your screen. If you still can’t find it, you may need to activate the utility panel by clicking on this icon:

acata06

3. Once on the Attributes Inspector of the Asset Catalog, you’ll see a bunch of devices and iOS versions listed. Check the one that says, iOS 7.0 and Later Sizes. Like this:

acata04

4. Look to the right and tada! There’s the 76×76 icon that you’ll need to fill in with a 1x and 2x version. Once you have that, it should eliminate those warnings.

acata05

All right, so I felt like a huge n00b when I discovered what was wrong. Especially after what amounts to hours of digging around XCode and wondering what on earth I was doing wrong. A quick Google Search after I’d already solved my own problem revealed the exact same solution was answered on StackOverflow.

But you know what? This was such a rookie mistake and I felt so accomplished (even if it wasn’t coding related) that I had to post about it because I don’t doubt that someone else, somewhere is going to have this issue too. OK, laugh at me and let’s get back to work. 🙂


Posted

in

by

Tags: