Avoiding having to recompute values within SwiftUI views

SwiftUI is a fantastic framework, with its declarative approach removing a lot of the complexity that comes with orchestrating UI updates. However, this benefit also comes with the cost, as developers can't have complete control over when and how the code in a View body property will be executed. Here, John Sundell explains an issue this can cause, and provides some approaches he uses to mitigate it.

Simpler way to deal with hardcoded ViewModifer values in SwiftUI

When working with SwiftUI, it's likely that at some point we will want to configure a property of our UI based on a conditional value. For example, setting a font color to red when an error occurs. However, as Daniel Tavares explains in this post, this can become cumbersome when we have a lot of UI properties that depend on conditional values. Luckily, Daniel has something which can help, and he shares it with us in this post.

Custom Property Wrappers for SwiftUI

A Swift property wrapper adds a layer of separation between code that defines a property and code that managers how a property is stored. By creating custom property wrappers, we write the management code once when we define the wrapper, and then reuse this code when we apply the wrapper to properties. In this post, Dave Delong shares some useful property wrappers that he has come up with while working on SwiftUI.