For any non-programmers reading this, a force-unwrap means that if your app comes across a value that just simply doesn’t exist at all ☁, then let the app crash right then and there 💥.
This article distinguishes between development, where it’s okay (and in sometimes encouraged) to crash, and production, where it’s never okay. I like the case here for avoiding poisoned app states that can occur with nil values. Just die already, already! 🤷🏻♂️ This article basically says that some development crashes are good because they expose problems, and to take a more aggressive approach with force unwrapping.
So be assertive with forced unwrapping. If there is no case where the optional should ever be nil, force unwrap
I think I’ll start taking more chances with force unwrapping and point to this article next time it comes up in a code review. 😉
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.
Feature flags are a great way to selectively introduce new features. it allows you to experiment and commit incrementally.
The only down-side to feature flags all the extra code, and in particular going back later together rid of all the crusty flag code flagging you feature on or off. This kind of tech debt can really pile up over time.
Apparently Uber uses feature flags in the thousands and without remorse. So they came up with this automatic way to wipe out your stale, disabled code. Perfect name, too!