Yet again somebody missed to insert a empty line before the end of file, I missed to provide a empty space after dictionary Key [AnyHashable:Any] and you might miss to leave any of these kinds of code:

//.......
    return data
}
func compute(a:Int,b:Int)->Int{
//.......

Which should have been:

//.......
return data
}   
  
func compute(a: Int, b: Int) -> Int {
//.......

So you see where I’m heading with this.

Bigger Picture

To just briefly explain the scenario, we are 12 iOS Engineers working harder than before (pun intended), cramming hundreds of line of code daily. We have bunch of features to roll out, release deadline to meet and a generation next to come and read the code we wrote with great thought. We couldn’t possibly achieve if, each of us, with unique style (tabs vs spaces) worked on. Thus, we have a Zalando iOS coding guidelines. Which keeps us in the same fashion. But like again, there is no way to actually force the project to have a strict guidelines and we humans are error prone.

Problem

Some empty line or no empty spaces sneaks in the code base. We need a tool to correct out the our style to Zalando iOS style. After all we care, because mainly we are a fashionable technology company. All right!

Solutions Available

  1. Swift Lint
    • Its a good library but we have some serious issue with it.
    • We have a large build time and this adds some more.
    • We already have hundreds of TODO and FIXME that are signaling warnings. This adds even more errors/warnings.
    • The tool has limited possibility of correction. Our solution is not to give things to the devs to correct. They are already busy. It is to work for them.

Our Attempt

XcodeFormatter

Technical Side

I prefer to run down the tech side by data flow or message flow.

A more deeper level working will be covered when this article is updated.

For details, check the readme file on github. XcodeFormatter On Github

Cheers!

comments powered by Disqus