A few months ago I discovered and installed ColorSense for Xcode, which set my mind to thinking what other common annoyances or inconveniences be improved in Xcode. It took me about three and a half seconds to jump from colors to images, as Xcode doesn't autocomplete imageNamed: calls. It's impossible to remember the names of all the images in a project, especially when there are a hundred or more images. Switching to the Project Navigator to check if the image is named button-highlighted-pressed.png or button-pressed-highlighted.png gets old quickly. Additional trips to check whether an image's 2x representation is added to the project only makes matters worse.

Armed with a new idea, a few free hours, and class-dump, I sat down and started hacking. I figured out how to insert items into Xcode's autocomplete lists, ran into a couple of roadblocks, quit for the day, and then promptly forgot about the matter entirely. And so the project sat and collected dust, as code is prone to do. Finally, last week I forgot the name of one image too many. So I now present to you KSImageNamed, an Xcode plug-in for getting the imageNamed: autocomplete that should have been there in the first place.

KSImageNamed in action

Want NSImage/UIImage imageNamed: autocomplete bliss in your copy of Xcode? Go clone and build KSImageNamed on GitHub.

Hopefully this will save you a little frustration the next time you type imageNamed: and can't remember the name of the image you were about to use. Even better, maybe this will get some people thinking about scratching an itch and making Xcode a little more pleasant to use. If there's any interest, I may do a follow-up with some details on how the plug-in works so others can start hacking on Xcode themselves.