iOS Best Practices. Part 1: Objective-C Code Style

Every day more and more people become developers. Of course, iOS development is a trend now. Common sense in programming says that we should write readable code. The code we leave should be easily understandable and supportable by each and every programmer.

1. The first important thing is the Code Style

Start from Code Style

I started with Objective-C.

At the moment, fewer and fewer projects use this language, but let’s go through the style for Objective-C.

Do not stretch the code vertically – for a long time, monitors have been able to fit readable horizontal lines.

Use the ternary operator only for a single condition. Don’t stretch it over 2 or more conditions.

Add a space after the scope in the method signature.

Naming: Don’t spare letters but do use distinct names.

Create Category for strong segmented functionality.

Write code that is easy to understand.

Comments, in my mind, are unnecessary. Decompose code into small, separate modules each with a single responsibility.

Use literals when you work with collections.

Collect all global values in a Constants file.

Use Boolean variables reasonably.
Monitor the list of imports, and do not overload the code with surpluses.

Of course, this isn’t anything new in code style, but just a collection of the best advice.

Continue readingiOS Best Practices. Part 2: Swift Code Style > > >

Maxim Vialyx

Maxim Vialykh is CactusSoft iOS Tech Lead.

Technical Background
Programming languages: Swift, Objective-C, Java
Technologies and Platforms: iOS, Android, Windows Phone, Amazon S3, Google Cloud, Google APIs, Facebook APIs
Frameworks: PhoneGap, Xamarin
Tools: Invision, SVN, Git, PhoneGap, Titanium, Xamarin, Sketch, xCode, IntelliJ IDEA

Share this page
We are experts
If there is a project needing help or even a skill set you are missing, contact us.
Subscribe To Our Newsletter
To get new inspiring articles and news right in your inbox.