Validating image references in XIBs

Today, I’ve made a small but useful script that I’ve published on RubyGems.

I’ll explain. Suppose you open a XIB and you see something like this:

You go over the element and check what’s wrong:

But… We’ve gotten rid of this image… No error? Nope. Warning? Don’t think so.


Enter XibImageValidator.

$ validate_xib
icon_service_good_l.png
icon_service_good_l.png
action_back_white
action_back_white
icon_service_bad_l.png
icon_service_good_l.png
icon_service_good_l.png
icon_service_bad_l.png
923D41A5-D5A7–4AB6–8EF0–8CFF24AE4D62
923D41A5-D5A7–4AB6–8EF0–8CFF24AE4D62
ic_arrow_8
ic_arrow_8
icon_real_time_s.png
icon_real_time_s.png
btn_switch_direction.png
btn_switch_direction.png

As you can see, action_black_white is indeed reported missing, as are other images, all of which I proceeded to go over and clean up where necessary.

Curious incident of the inline image

See the image named 923D41A5-D5A7–4AB6–8EF0–8CFF24AE4D62? That doesn’t make sense, right? Well, apparently the image wasn’t a reference, but somehow got inlined into the XIB!

That’s all for today, folks!

Find XibImageValidator on GitHub.

Like what you read? Give Igor Makarov a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.