Handling Audio Sessions with Bluetooth in Swift for iOS

When creating an iOS app that deals with audio, it’s important to configure and handle audio sessions properly. Along with setting up an audio session, there are some extra steps required to properly support Bluetooth audio. 1. Configuring Audio Sessions By default, audio sessions support audio playback but not audio recording. If your app supports […]

Ergonomic Struct Updates in Swift

Lately, I’ve been working on a project that employs a Redux-inspired state management architecture built using Swift and SwiftUI. Of course, because of the Redux pattern we employ, we have lots of reducers with the signature (state, action) -> state. All of our states and sub-states are held in Swift structs. The out-of-the-box, value-type semantics […]

Customizing UIWebView for PDFs in Swift

UIWebViews are a handy way to show web content in an iOS app. They are especially useful for showing PDFs that are stored remotely. Apple largely treats UIWebViews like a black box: Documentation warns that they should not be subclassed. So what if you want to customize how they show PDFs? Recently, I went after […]

A Swift Architecture for Managing State: Revised

In my previous blog post, I wrote about an approach for managing state in a Swift app. Following that post, some changes were made to the Swift language that deprecated some convenient syntax my approach relied on. After some thinking, and with a better understanding of Swift’s approach to mutability, I’ve slightly revised this architecture […]