Even though Android applications were downloaded two times more often than iOS apps in 2017, the latter are also widely popular. Nevertheless, the popularity of Apple devices is growing, and so is the demand for iOS developers. If you are or want to be one of them, this article is for you, because I will show you the best iOS practices. They will help you to develop better applications. Ready?

I have divided the practices mentioned above into the following sections:

  • General Technological Concepts
  • Code Quality
  • Performance
  • Frameworks
  • Architecture
  • Other useful tips and tricks

General Technological Concepts

ios development

In this section, I have just three words for you:

  • SOLID – Single responsibility principle, Open/closed principle, Liskov substitution principle, Interface segregation principle, Dependency Inversion principle
  • KISS – Keep It Simple, Stupid
  • DRY – Don’t Repeat Yourself

Code Quality

code quality apple

First of all, you should follow code styling guides prepared for Swift and Objective-C. This matters a lot, especially when only a few programmers are developing the same application. It’s like starting a music band – if everybody does their own thing, they won’t succeed, and the same goes for developer teams.

If you can repeat advice from these guides in the middle of the night, you can move on to the next step – automating your builds. Use Fastlane to configure every project to build automatically, and then upload it to HockeyApp.

Finally, avoid a vast amount of code in a single view controller. You can use either VIPER or MVVM architecture to accomplish this.

Performance and maintainability

695A7374

Although iOS devices are pretty fast and they work great no matter how old they are, your application can’t slow them down.

You can improve performance and maintainability of your application by:

  • Trying to avoid external UI libraries
  • Deciding on the minimum iOS version early on – remember to check if new iOS APIs are being handled properly on older systems
  • Integrating crash reporting tools

Frameworks

Use these frameworks to make your work easier, faster and better.

Networking

Models

Dependency Injection

Stores

Architecture

Start your project by structuring it logically. Its structure should reflect the directory structure in your repository. Regarding folder names – they should be lowercase, and spaces should be replaced with “_”.

Make the project’s hierarchy reflect your architecture, i.e.:

  1. UI: contains references to custom UIViews, UIViewControllers and containers:
  • Views: Custom UIViews, UITableViewCells, …
  • View_controllers: UIViewControllers
  1. Application: AppDelegate
  2. Supporting_files: info.plist and other files describing the application
  3. Resources: fonts, images, videos
  4. 3rd_party: library that can’t be added as pod
  5. Connection: to your web service
  6. Managers: link between UI and Connection layers
  7. Parsers: data parsers
  8. Utils: utility classes that are being used throughout the project

Dependency Injection is the next useful and crucial thing. One of its definitions states that it’s a technique whereby one object supplies the dependencies of another object. One more thing to remember – any required objects should be passed as parameters.

If you want to manage an external dependency, use an explicit version of CocoaPods or Carthage, and update it only if necessary. And if you decide to use Pods, don’t add its folder to .gitignore.

Other useful tips and tricks

ios development

The final section and four simple tips and tricks to improve your applications even more:

  • Avoid using Storyboards
  • Use Workflows or FlowControllers to handle View Controllers
  • Any text that is visible to the user should be localized
  • Treat warnings as errors

Fresh software development tips delivered straight to your inbox

Subscribe to our monthly newsletter with useful information about building valuable software products.
Don't worry, we value your privacy and won't spam you with any bussines enquiries!

michal_karpowicz

Software Developer

iOS developer by day, game developer by night. Swift, Unity, clean code and coffee.