BLOG
15 August 2019

iOS App Development Best Practices We Follow at SoftwareHut

tech

The popularity of Apple devices is significant, and so is the demand for iOS app development. Learn about iOS app development best practices.

In 2018 and in the Q1 2019, Android and iOS remained their positions on the market of mobile operating systems, with market shares of 76% and 22%.

If you want to create your own iOS mobile app, there are best practices for you to follow. At SoftwareHut we make iOS apps for our clients, and in this article I want to share with you some of our proven patterns.

I have divided the iOS app development best practices into the following sections:

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

iOS Best Practices: General Technological Concepts

iOS Best Practices: General Technological Concepts

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

iOS best pracrices: code quality apple

First of all, you should follow code styling guides prepared for Swift andObjective-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

iOS development

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.

iOS App Development Best Practices: Useful Tips and Tricks

iOS App Development Best Practices: Useful Tips and Tricks

To sum up, here are four simple tips and tricks to improve your iOS app development 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



Author
Michał Karpowicz
Software Developer

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