Scalable iOS app architecture
India continues to be a go-to offshore destination for scalable iOS app development. This confidence in the Indian IT ecosystem is strongly complemented by recent $1Bn investments made by official Apple suppliers to manufacture the hardware components in India as well. Not just the development but the adoption of Apple devices itself has seen an increased proliferation into Asian markets. iOS is slowly & steadily making its way into Asia, now claiming 16% of the market i.e., an increase of 4% from last year. In the American market, it’s already the leading player with 50% plus share and in Europe, it commands more than 25% of the market share. Also, it has been observed that revenue per customer generated from Apple users is way more than any other device/OS users.
So, wouldn’t it make sense for any business, including yours, to devise the right strategy for targeting and converting iOS users? If there is an intersection between your potential client base and Apple’s user base then it certainly does make sense. And “scalable iOS app development” has got to be an integral part of your iOS strategy.
Thinking WHY?
Within 3 days of the release of Pokemon Go, a game app was clocking more app installs in the US than what Tinder could garner over the years. Few more days down the line, it was enjoying daily active users on the platform close to that of Twitter.
Recently, we saw how Zoom’s user base shot to the levels of 300 Million monthly active users in March 2020 from 10 Mn active users in Dec’19.
Of-course, virality was a factor behind PokemonGo’s success and usability behind Zoom’s. But technically, what enabled these apps to successfully spike to such insane levels without breaking down?
A system that handles a growing amount of customers by adding resources to the system is called a scalable system.
Scalability is important for your app’s success. When your app is scalable, it can enhance growth, offer a good user experience for new users. If your target audience is in millions then good planning and execution are required from the beginning. The best time to manage the scaling of an app is before an issue arises. There are some very important things that I discuss in this article.
Components
In the very first step, we started dividing the existing applications into logical units. As apps grow larger and larger, their complexity also increases. As teams and apps grow, boundaries in a codebase begin to grow naturally, this leads to a more complicated codebase that becomes harder to test, harder to refactor.
When you’re starting a new project or refactoring an existing one, you need to think carefully about whether you need something to be its own module or not.
Once you’ve decided that you have a problem, and modularizing your codebase can fix this problem, you need to identify the scope of your modules. For example
- Data storage
- Networking
- Model definitions
- code that’s used across many projects
- business logic that used on tvOS and iOS
- UI components or animations that use in multiple projects
- I hope it gives you an idea of what things might make sense as a specialized module.
Folder Structure
The folder structure is very important for code maintainability. after working on multiple iOS projects, I have developed a basic file structure that I use to make the application easier to grasp.
The organization in the root project folder consists of the following folders:
- App: This folder contains two files in a basic iOS project: “AppDelegate.swift” and “Info.plist”. I place this folder at the top of the root folder to ensure that these files are always easy to find. This folder can also hold configuration files and files that are global to the entire app.
- Constants :
- Views
- Controllers
- Models
- Extensions
- Resources
- Storyboard
- API
- Supporting Files
What’s the perfect architecture?
Good architecture, it’s such a hard topic. There is no silver bullet. I don’t believe there is a single architecture that can solve all your problems and I think one should always consider things in regards to the use cases and the requirements gathered from the clients.
Therefore some features of a good architecture include:
- Balanced distribution: It also helps in improving the performance of a system.
- Easy to understand and Ease of use
- Testability
- Maintainability: An architecture should be strong and not be vulnerable to minor changes in the business, information, application, and technology systems.
- Flexibility: The architectures must be flexible and be able to adapt to changing conditions.
Ther are some popular design patterns
- Model View Controller
- Model View Presenter
- Model View View Model
- Viper
For more information refer:
https://medium.com/swlh/ios-design-patterns-a9bd07818129
https://medium.com/ios-os-x-development/ios-architecture-patterns-ecba4c38de52
Development Tools/Third-Party Libraries
iOS app development tools will simplify any iOS development. First, remember to establish the basic infrastructure. Then, follow the standard practices of creating several versions. After that, decide which architecture will be most efficient for the project. Also, take advantage of third-party tools and libraries.
There are some tools that I have found useful
SwiftLint is a great tool that will make sure you and your team are following the swift coding styles and conventions. It’s really easy to use and integrate. It’s open-source and you can use only the rules you want and even write your own rules.
2. SDWebImage
It is an Asynchronous image downloader with cache support as a UIImageView category. It has UIKit categories to do things such as set a UIImageView image to a URL.
Alamofire is a Swift-based, HTTP networking library. It provides a simple interface on top of Apple’s Foundation networking stack that simplifies common networking tasks. Its specialties include chainable request/response methods, JSON and Codable decoding, authentication, and more.
SwiftyJSON is a simplified JSON parsing library that gives you more precise syntax than the built-in iOS libraries (yes, even more than JSONEncoder from Codable).
PromiseKit is a framework that will simplify working with async code and make your code very elegant and simple to follow.
Continuous Integration and Continuous Delivery
Continuous integration and continuous delivery (CI/CD) is extensively used by development teams, even in open-source communities. It offers a sustainable approach to test and deploy code many times a day without the obstacle of doing it manually.
Benefit of Continuous Integration/ Continuous Development/ Continuous Delivery
- Fewer bugs are passed to production as mostly are captured during automated testing.
- Generating a build can be automated.
- The developer will get to know about any bugs in the building phase & can work on fixing them before moving it to another phase.
- QA team will get more time to improve the product quality
- Released builds are less risky & can be easily fixed.
- Customers can notice continuous improvement & quality of products on an everyday basis.
Remember, a scalable mobile app is a systematic approach to create a mobile app that is always available, performs flawlessly, retrieves all the data quickly, responds in real-time, and always has room for more functionalities. The above information helps you to build scalable and maintainable iOS projects. However, please keep in mind that things may change over time.
Follow me on LinkedIn