Configuring SublimeText for Objective C Development

The popular code editor SublimeText comes baked in with support for Objective C syntax highlighting. What it doesn't come with, however, is automatic error checking and decent autocomplete for Obj-c code. Fortunately, there's a plugin for SublimeText that will do just that: SublimeClang.

SublimeClang adds proper syntax and error highlighting within your code, as well as autocomplete for Obj-C and C++ classes. It does take a little bit of configuration to get it working, however. Here's how I made it work for me.

  1. Install SublimeClang using the instructions on its github page.
  2. Install XCode from the Mac App Store, if you haven't already. Make sure you also install the iOS and Mac OS core libraries.
  3. Navigate to this menu, and open the default settings for SublimeClang. It will open a file called SublimeClang.sublime-settings. This is the file you need to modify to make it all work properly.
  4. In the SublimeClang.sublime-settings file, scroll down to about line 240 or so, and you should see a line that looks like "options:" followed by an open bracket. Inside of those brackets, you'll need to insert these lines (if they don't already exist).
  5. There's one more step to set it up. What you did in the last step was to tell SublimeClang to include those files for error checking. What you'll need to do now is to open up an Objective C header file. The ending of the file should be .h. Then, navigate to this menu, and select Objective C.

That should be it! Having done this, you should be able to use SublimeClang to do automatic error checking in your Objective C code.

Need help? Leave a comment and I'll answer any questions you might have.

Arthur Rosa is an engineering manager based in Sunnyvale, California.