Snapp Mobile iOS Newsletter

Issue 17 • November 22, 2024

Hi again!

This week, we dive into the problem of changing the iOS/iPadOS status bar style programmatically. We ended up picking not one, but three (!!!) articles on the topic, and we think this is one of the spots where Apple has a lot of room for improvement.

Enjoy.

Swift

Building an AsyncSequence with AsyncStream.makeStream

AsyncStream is among the most convenient structs in Swift’s Concurrency framework, as it allows us to create a stream that emits values over time. Creating these streams used to be somewhat clunky until Swift 5.9, but now we have a concise way of creating them in makeStream(of:). Here’s how.

UI/UX

How to set status bar style

Sometimes the default dark status bar in your view controllers can feel out of place — think of a custom presentation with a black background, for example. Here’s a quick refresher on the not-so-straightforward way to change the status bar style programmatically, when needed. Bonus points for the fact that this article shows you how to animate the transition.

Handling status bar color scheme and visibility in SwiftUI

If the article above showed you how to handle the status bar style changes with UIKit, this one focuses on how to do the same task with SwiftUI. It uses a different approach to work around the behavior of the .toolbarColorScheme modifier. This modifier is available from iOS 16 onwards, so in case you need to support an older version, check the next article.

SwiftUI: Dynamic status bar style

Wow, a third article on status bar style, what’s going on here? Well, this one goes into the rabbit hole of method swizzling to bring the behavior on iOS versions lower than 16. If that’s not enough to highlight the complexity of the status bar style switching, we don’t know what is.

Automatic Trait Tracking

A new addition to UIKit in iOS 18 is the ability to automatically track when you access a trait from the trait collection so that you no longer have to register for notifications on trait changes. This article explains how it eliminates some boilerplate.

Scrolling pickers in SwiftUI

Here’s an interesting UX concept that we stumbled upon recently — a scrolling picker, implemented in pure SwiftUI. It highlights how flexible SwiftUI is for creating custom components, but it also shows how much there is for consideration when building them.

visionOS

visionOS: Accessing the main camera

This article explains how to use the front left camera with ARKit for your visionOS projects, with an example. Using the main camera requires an entitlement and is only tailored towards enterprise customers for now, but it’s a welcome step forward for the platform.

Talk

SwiftUI Animations

Another talk from Swift Connection 2024. This one looks at one of the most fun topics—animations. As many of us know, Chris Eidhof is a person to trust when it comes to SwiftUI and animations, so this talk is full of goodies. We know you’re gonna like it.