r/iOSProgramming • u/dg02512021 • Mar 10 '22
Article iOS development best practices in 2022
Hi guys, we published an article with 1 min guide to iOS development best practices.
Please have a look and provide us with your valuable suggestions and feedback. The list is a starting for you to get inspired by and should not be used as it is for all apps. Usage differs depending on app size, type, complexity and other requirements.
https://blog.canopas.com/1-min-guide-to-ios-development-best-practices-in-2022-e3f1d009cfa1
If you think we missed something, let us know. We will update it to make it more meaningful for other iOS devs out there.
5
u/this-is-not Mar 10 '22
Async await might be preferred over using Combine, no?
5
u/dg02512021 Mar 10 '22
Well, it actually depends on the use cases. In my opinion, For one time results, async-await is preferred and for the stream, combine is the best solution.
3
u/is_that_a_thing_now Mar 10 '22 edited Mar 10 '22
Thanks. This is a nice list to get inspired by. One point puzzled me a bit though. Feature flags. I can easily see a FeatureFlag hell as well. At best this is a thing to consider and not a best practice.
It depends on the kinds of features and how teams are organized. The separate developers/teams should always stay coordinated and maintain a degree of consistency with the main/development branch, but they can diverge from the main branch in wildly different ways. Supporting this with flags in the one and same code base can result in a combinatorial explosion of complexity.
A feature that undergoes many changes or perhaps even ends up being canceled would have bothered everyone else for no reason at all.
It will in general be far better to keep things separate until the separate projects/features reach a point of maturity where you can begin to consider merging - with the main/dev branch. (Perhaps then with feature flags for a very limited time)
No biggie though. The list is super useful.
3
u/dg02512021 Mar 10 '22
You are right. It's not a best practice. Also, it's useful in special cases only.
I will update the article in a day or two. Thanks for sharing your knowledge and experience.
11
u/Niightstalker Mar 10 '22
I don’t really see a reason to use Alsmofire anymore for networking requests. The built in URLSession improved by a lot over the last years and is pretty easy to use by itself now.
4
u/anymbryne Objective-C / Swift Mar 10 '22
Heyy, so uhm, just wanna ask. By recommending Sqlite, would you choose it over CoreData?
3
u/foodandbeverageguy Mar 10 '22
Best practices != use all third party frameworks. Other than linting, almost all these problems can be solved natively. If a developer told me Kingfisher was the best practice for downloading images I wouldn’t hire them.
4
2
2
u/jjhageman Mar 10 '22
I don’t think it’s fair to label this list as iOS Development Best Practices as it’s far too opinionated and customized to your app and team. For many of these suggestions, you are adding too large of a layer on open source frameworks, and therefore dependencies that each library will be updated and bug-fixed in the future. Imo, most teams/companies should strive to own their own destiny and write their own networking layer, async image loader, keychain wrapper, etc.
For many apps Core Data will be a better data store. Especially those with an object graph paradigm.
Regarding MVVM, since your list is very SwiftUI-forward (which is great) I’m surprised that the Composable Architecture pattern was not mentioned. (https://github.com/pointfreeco/swift-composable-architecture)
The best practices that apply generally across iOS development from your list are: using a code linter, dependent injection (and composition over inheritance), feature flags, modularization (in later stages as the app grows), unit tests, measuring code coverage, investing in CI/CD, and security.
I read this list more as you sharing your team’s tech stack, which I found interesting to learn about from that angle.
-6
u/tbihitesh Mar 10 '22
Hi, I have read your article written by Amisha I about "1 min guide to iOS development best practices in 2022". And I found it interested. You can also check what I have written about the Functional Tools used for iPhone App Development.
16
Mar 10 '22
[removed] — view removed comment
6
u/dg02512021 Mar 10 '22
Really good point! While the library was good, it has not been updated lately, I will remove it. If you have a better alternative, please suggest it!
28
u/Own_University6674 Mar 10 '22
In all honestly this looks like a blogspam list to draw traffic to your services, that's fine(ish..). But without context and explanations it simply seems like a list of things YOU happen to be using at your agency.
---
How can SwiftUI be a best practice when it is so controversial for maturity.
Why is Combine best practice over RxSwift? Purely because it is from Apple?
Alamofire seems hardly a requirement anymore, like it was considered before.
Swinject seems like it is something for large complex apps, it wouldn't be good practice for something tiny. Context.
MVVM, Modular, same. Depends on the project scope.
EarlGrey, why not just use plain old XCUITests? They work perfectly fine and I really don't see why we need to use it. At my last company we had hundreds of tests.