And yet we all do it because it also has its benefits. 🤦🏻♂️😂
That article is a realistic and practical look how the dependencies affect your app in terms of app launch times, app size, and build times. It compares Swift Package Manager 🤓, Carthage 🤷🏻♂️, CocoaPods 😬, manual dependency management 🥺, and Git Submodules 🤮.
I still have a dream of zero dependencies 🤩, but I know it’s not realistic in a complex app. 😑
Error handling makes everything more complicated. Ugh! What do you do if a network call times out (pretty common)? Or you’re trying to save an image and there is no disk space (less common but can happen)? Or that thing that’s never supposed to happen happens (occasionally happens)?
I mean, you have to do something, right? Ugh. 🤦🏻♂️
Here are some tips. Thanks to Swift By Sundell for giving this topic some attention.
App users may not be aware — and app developers often forget — that favorite app of yours might be running native code from a third party such as Facebook. Besides making your app potentially way bigger to download, it can also cause instability. When Facebook screws up, suddenly you can’t run TikTok, Spotify, and countless others apps.
It was as if Facebook had an “app kill switch” that they activated, and it brought down many of people’s favorite iOS apps.
For this and other reasons such as added integration complexity, when I’m making my next app, I am going to try to minimize third-party libraries.
It seems like software architecture often focuses on theoretical concepts and cool ideas, but we should look at things like this that can impact millions of real users. IMHO we developers need to consider third-party libraries as a liability to be weighed against the vulnerabilities they open up. 💥
Most of us developers know can we can should abstract the network layer to support mocking, unit testing, and just to produce a more flexible design.
While lots of us know this, in practice it seems to get overly complicated and not always done well. A good design should simplify things, not complicate things. This is why I like this post focusing on using protocols to simplify network requests and improve testability. It even gets into decoding responses to give you a useful end-to-end flow.