DEV Community

Sadman Samee
Sadman Samee

Posted on

Keep your iOS projects healthy

Keeping your code and projects is the best thing you can do to your projects and here’s how to do it your iOS projects written in swift.

Following style guide

There are several style guide for writing swift, and every team member should follow them well. Such as

  1. Raywinderlich style guide
  2. Linkedin style guide
  3. Google style guide

Using tools

In reality not everyone does it properly so there should be a way to enforce it amongst team members, a way of doing is manual code review which is very time-consuming and code review should happen in logic level not how a developer should declare variable or indentation, we could simple automate these things and invest our time more on harder things.

  1. Swiftlint will excellently lint the swift codes.
  2. You can also add linting for storyboard and xib files with xiblint
  3. It is also preferred to have a one way of formatting code like how many indents, way declaring variable etc and this is where Swiftformat shines really well.
  4. To Eliminate Unused Swift Code go for periphery
  5. Having a static analysis of your codes is a good way to have fewer bugs, Infer is a static analysis tool that produces a list of potential bugs.
  6. You can also automate using these tools on Continuous Integration level using danger. You can use Danger to codify your teams’ norms. Leaving humans to think about harder problems. And danger supports Circle, Travis, Jenkins, Buildkite, BuddyBuild, Semaphore, TeamCity, Xcode Bots, Drone, Surf and Bitrise.

Organising Xcode projects

In older versions of Xcode you could only group and in beneath there was no folder structure so basically every file used to stay in one single folder by default and this is messy!

  1. You can use Synx, a command line tool to create folder according to Xcode group.
  2. And sometimes your Xcode project might be corrupted and broken and you can get back your Xcode project based on folder structure using XcodeGen, A Swift command line tool for generating your Xcode project.

Top comments (0)