Tracking Down Storyboard Warnings

Xcode seems to have this annoying problem where sometimes, most of the time for me, when I select a storyboard warning it will open the file, but won’t show me the item that’s affected. This is becoming a real problem now that layout margins and Automatic Preferred Max Layout Width on UILabels seem to be the default.

Reveal compiler output
Reveal compiler output with this thingy

I’m working on a project that contains a pretty huge storyboard where trying to find the culprit would be like looking for a needle in a haystack. Fortunately I discovered a trick. Not sure trick is the right word but whatever. Here’s what you do. Switch to the Report Navigator and select your most recent built. Make sure “All Issues” is selected and locate the storyboard that contains warnings. Then click the hamburger looking button to the right to see the compiler’s actual output.

Storyboard IDs
Compiler output shows the storyboard IDs

After expanding the compiler output, you should see a list of your warnings towards the end. These warnings include the storyboard path along with an identifier and the warning text. Copy the identifier for the warning that you want to investigate and then paste that into Find In Workspace (⌘⇧F).

Find In Workspace with storyboard elements
Find In Workspace with storyboard elements

Voila! Xcode should display the problem storyboard element as a result. When you click on the result it will open the storyboard and select the element in question allowing you to fix the edit.

Maybe this is a thing everyone already knows about but it was news to me when I accidentally stumbled across it a little while ago. Hopefully you find it useful.