Hi again,
This week, we dive deep into the nuances of Swift Concurrency and synchronization, with insights on avoiding unexpected suspension points and a comprehensive guide on choosing between Actors, queues, and locks. We explore the possibilities of SwiftUI with accelerometer-driven UI effects and an introduction to the new WebKit for SwiftUI API, while also focusing on accessibility with a guide to audio descriptions. Additionally, Natalia Panferova helps us master background app refreshes, and we discover MacFansControl for native macOS thermal management.
Enjoy!
Articles
Swift
Unexpected Task suspension points in Swift Concurrency
Ever wondered how unexpected suspension points in Swift Concurrency can negatively impact app performance by causing unnecessary main-thread hopping? Antoine demonstrates how inheriting @MainActor isolation in a Task can block the main thread and delay UI updates. The article provides a solution using @concurrent to ensure tasks start on a different isolation domain and use MainActor.run for UI updates.
Synchronization in Swift: Actors vs Queues vs Locks
This entry provides a comprehensive comparison of synchronization tools in Swift, ranging from high-level Actors to low-level Locks, Mutexes, and Atomics. It explains the trade-offs between safety, performance, and API design, highlighting how Actors encode isolation in the type system while Locks offer minimal overhead for synchronous paths. It also concludes with practical guidance on choosing the right mechanism based on the component’s requirements and the surrounding environment.
Accessibility
Audio Descriptions
Here’s a detailed guide on implementing audio descriptions in SwiftUI apps to make video content accessible for blind and low-vision users. The article explains how to detect user preferences and use AVFoundation to manage and select descriptive audio tracks. It also outlines the process of creating these tracks and shares a set of best practices for writing objective and concise descriptions.
UI/UX
Scheduling and handling background app refresh in SwiftUI
This article explains how to implement background app refreshes in SwiftUI apps using the Background Tasks framework. It covers the essential setup steps, including adding background capabilities in Xcode and registering task identifiers in the Info.plist. It also demonstrates how to schedule tasks using BGAppRefreshTaskRequest and handle them with the .backgroundTask modifier, while also providing a method for testing these tasks via the Xcode debugger.
Controlling views using the accelerometer
The author demonstrates how to use Core Motion to control SwiftUI views using the device’s accelerometer and gyroscope. He provides a practical implementation of a MotionManager wrapper and explores various creative effects, such as screen-blending shapes, masking text with dynamic gradients, and achieving 3D rotation. The article emphasizes how minimal effort can add “spark of delight” to a user interface through real-world interaction.
Do I need Identifiable on my Generable object used in an array?
Nothing beats a great tip on using Identifiable in Generable objects when interacting with Apple’s on-device intelligence models. We love this format - on-point, graphic and useful :)
Tools
MacFansControl
MacFansControl is an open-source macOS utility built with Swift and SwiftUI that allows users to monitor temperature sensors and precisely control fan speeds on both Apple Silicon and Intel Macs. It features a visual multi-point fan curve editor, customizable menubar readouts, and safety watchdogs to prevent overheating if the app crashes. The project emphasizes a lightweight, “no-bloat” approach, providing native performance without using Electron or web views.
Talk
Meet WebKit for SwiftUI
Richard introduces “WebKit for SwiftUI”, a new API that simplifies integrating web content into apps across all Apple platforms. The session covers the new WebView and WebPage components, allowing developers to load remote URLs, HTML strings, or even local resources via the URLSchemeHandler protocol. It also highlights advanced features like JavaScript communication with callJavaScript, custom navigation policies with NavigationDeciding, and SwiftUI-native scroll position syncing and “Find-In-Page” support.