Software Dev

We All Hate Error Handling. Here Are Some Tips.

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.

πŸ‘‰ Propagating user-facing errors in Swift

Via iOS Dev Weekly.

Software Dev

Point-Free Composable Architecture

A new software architecture! Hurray! πŸ™ŒπŸ€·πŸ»β€β™‚οΈ

I’m filing this away as an idea to try on my next app because all other architectures are still just annoying in some way, and this one has a good name. πŸ˜†

This architecture is designed to work with SwiftUI and UIKit on any Apple platform (iOS, macOS, tvOS, and watchOS).

πŸ‘‰Composable Architecture, the library

Via iOS Dev Weekly.

Software Dev

The Big Facebook Crash and Third-Party SDK Vulnerabilities

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.

This actually happened recently. πŸ’₯

πŸ‘‰ The big Facebook crash of 2020 and the problem of third-party SDK creep

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. πŸ’₯

Via iOS Dev Weekly.

Also, a shout out to the “App-ocalypse” video from this article. πŸ˜†

Software Dev

Communication Patterns in SwiftUI

Are you wondering how to get some information from one component to another in SwiftUI? Too many options to consider? This helpful post walks you through all the scenarios.

πŸ‘‰ View Communication Patterns in SwiftUI

Cheat sheet:

  •  From Parent to Direct Child – Use Initializer
  • From Parent to Distant Child – Use Environment
  • From Child to Direct Parent – Use Bindings and Callbacks
  • From Child to Distant Parent – Use PreferenceKey
  • Between Children – Lift the State Up

Via iOS Dev Weekly.

Software Dev

Using Protocols to Remove the Network Layer from Your iOS App

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.

πŸ‘‰ Removing the network layer in your iOS app

Even better, this is part of a Power of Protocols series (yay!).

Software Dev

Playbook

Developing features for a large, established app, I often run get slowed down trying to throw together a new screen. You have to find the right spot in the code to update, build the whole app (not just what you changed), log in, and drill down to the right spot to try out your creation. Something’s off? Do it all over again.

Which is why I love the idea of the Playbook library, which is “a library that provides a sandbox for building UI components without having to worry about application-specific dependencies.” Yass! 🀟

πŸ‘‰ Playbook on GitHub

Supports both SwiftUI and UIKit.

playbook

Via iOS Dev Weekly.