Best Practice iOS Development
Best Practice iOS Development
1. Use SwiftUI —SwiftUI helps you build great-looking apps across all Apple platforms with
the power of Swift — and as little code as possible. With SwiftUI, you can bring even
better experiences to all users, on any Apple device, using just one set of tools and APIs.
2. Choose Combine over RxSwift— A framework that provides a declarative Swift API for
processing values over time. These values can represent many kinds of asynchronous
events.
4. Use SwiftLint for Code formatting — A tool to enforce Swift style and conventions,
loosely based on the now archived GitHub Swift Style Guide. It enforces the style guide
rules that are generally accepted by the Swift community.
5. Use UIPilot for easier SwiftUI navigation — Handle complex SwiftUI navigation very
easily and reliably with UIPilot.
6. Use SQLite library for local Database — The better approach for data persistence and
also works as a lightweight, Swift-friendly wrapper over the C API.
8. Use Kingfisher for Image loading — A powerful, pure-Swift library for downloading and
caching images from the web in swift. SwiftUI provides its own AsyncImage view that
asynchronously loads and displays an image from API.
10. Coding with Feature Flags — To be able to keep shipping the app while features are
still in development, use feature flags. Feature flags will allow teams to have multiple
variants of the app that can be managed by just a few flags and will save you from having
GIT branch hell.
11. Use MVVM architecture — The perfect solution for all the drawbacks of MVP and
MVC, which makes code testable, more decoupled, and easy to maintain which is a widely
used design pattern for architecting software applications. MVVM architecture also plays
very nicely with SwiftUI.
12. Modularize your app by feature — Faster build, reduce boilerplate code, smaller and
maintainable modules, fewer circular dependencies, easier navigation, separation of
responsibility, and many more benefits…
13. Use UserDefaults to store plain key-value pairs —An interface to the user’s defaults
database, where you store key-value pairs persistently across launches of your app where
the value data could be String, Integer, Boolean, or any type of Object.
14. Use SwiftKeychainWrapper to store secured key-value pairs — A simple wrapper for
the iOS / tvOS Keychain to allow you to use it in a similar fashion to User Defaults. Written
in Swift which provides a singleton instance that is set up to work for most needs.
15. Always measure your Code coverage —You can either go for a built-in option like the
Xcode 12 coverage tool, or you can pick a free library like Slather, which will generate test
coverage reports for Xcode projects and hook them into your CI.
16. Test your classes with Unit tests — You already know the importance of writing unit
tests. You can use the XCTest or Nimble library to write tests easily. Also, use dependency
injection if not already to allow using mock/stub classes during tests.
17. Test your UI with EarlGrey 2.0 — A native iOS UI automation test framework that
combines EarlGrey with XCUITest, Apple’s official UI Testing Framework.
18. Use CI/CD to automate development — CI/CD is a must tool to make the development
process automatic. Automate all manual tasks and then keep pushing builds without
recurring efforts!
19. Use Firebase crashlytics for App analytics — The lightweight, real-time crash reporting
tool makes it easy for you to manage the stability of your app.
20. Prioritize app security — User privacy is paramount. To help people trust your app, it’s
crucial to be transparent about the privacy-related data and resources you require and
how you use them. Check out apple’s official guide on Accessing User Data and Resources.