Style Checking for iOS Development

In a recent episode of Silicon Valley, Richard and Winnie had a fight about Spaces vs Tabs. It reminded me of this comic on the debate: TabsSpacesBoth

Obviously the point of the comic is that the decision is fairly arbitrary, but consistency is of the utmost important.

So the question is: Teams how do you stay consistent? or How do you stay consistent to your former self? The answer: Style Checking.

So I thought I'd write this blog post to talk about the way I use style checking. Obviously I spend a lot of time doing iOS, so let's talk about that.

Firstly, I have a few requirements for such as tool.

  1. Support both Swift and Objective-C
  2. Produce inline style errors in Xcode
  3. Easy to configure
  4. A nice settings file that could be checked into Git
  5. Free or low cost

What I found about 2 years ago was Objective-Clean (and later, it's sister product Swift-Clean). These are fantastic tools created The Ostlers and have served my needs since.

Objective-Clean icon

Swfic Clean icon

The workflow is really simple too. To start, simply gather your team and take the survey together. Once the yelling ceases and the evil eyes have stopped being made, you'll have yourself a downloadable settings file.

Once you've got that, grab a copy of the software (It's very cheap at $10USD).

Then, open the app, drag your xcodeproject or xcworkspace into it, and it'll configure itself. Under the hood, it adds a build step that'll style check your code after each build.

From there, the style errors will jump out at you, and you can take a small amount of time to bring your project up to consistency. Boom.

So that's how I take care of Style Checking. Props to Blair for showing me the ways back in the day. It's been rewarding to keep our code looking 💯.


Do you use style checking? If so, what do you use? Do you know any other tools? I'd love to hear from you on twitter - I'm @samjarman.