NEW BOOK! SwiftUI Fundamentals: The essential guide to SwiftUI core concepts and APIs. Learn more ...NEW BOOK! SwiftUI Fundamentals:Master SwiftUI core concepts and APIs. Learn more...

Nil Coalescing Newsletter - February 2025

Hi there,

It’s already the end of February, which means it’s time for the second issue of this newsletter! We’ve been enjoying the last days of summer here in New Zealand, and it has been a busy month for us at Nil Coalescing.

The biggest news this month is the release of my new book - SwiftUI Fundamentals. Writing this book has been on my mind for a long time, and it brings together my experience working with SwiftUI over the years.

I’ve been using SwiftUI since its first release in 2019, and I had the chance to contribute to the framework as part of the core SwiftUI team at Apple from 2020 to 2022. During that time, I worked on some of the most important and widely used APIs, including text, modal presentations, navigation, and others. After leaving Apple, I kept building with SwiftUI, working with different teams and gaining a deeper sense of how the framework is used in production, what works well, what doesn’t, and where misunderstandings tend to happen. I wanted to bring those insights together in a way that would help others, which is why I wrote "SwiftUI Fundamentals".

"SwiftUI Fundamentals" explains how SwiftUI really works, covering topics like view rendering and updates, data flow, the mechanisms behind view modifiers, text rendering, layout, and animations, along with other essential aspects of the framework. It focuses on the core APIs and concepts that are key to understanding SwiftUI and using it effectively in real projects. My goal was to create a solid foundation for anyone working with SwiftUI, whether they are just getting started or have been using it for a while and want a deeper understanding of how everything fits together.

The book launched last week, and I’ve already received some wonderful feedback, which has been really encouraging. If you’d like to learn more, you can find all the details on our books website.


Projects

Django Channels Rest Framework

Matt has been busy working on a major update to his open source project, Django Channels Rest Framework, which extends Django Channels with additional WebSocket capabilities.

The latest v1.3 release introduces automatic observation of changes in many-to-many fields. This allows subscriptions to a user record or a filtered list of users over a WebSocket, with notifications sent whenever a user is added to or removed from a user group.

All of this happens at the Django ORM level, meaning updates propagate automatically regardless of where changes originate, whether through the admin console, API requests, or elsewhere, without requiring additional code.

Strolly: Generated daily walks

We've also been working on updating Strolly, our app that generates unique daily walking routes. We first built it for ourselves to add variety to our daily dog walks, then decided to release it on the App Store last year.

Strolly generates all routes on-device using Apple’s MapKit framework. It retrieves local points of interest with MKLocalSearch and constructs routes using MKDirections, combining segments to form complete looping walks. To ensure privacy, no location data is sent to external servers, and all path calculations happen locally.

Recently, we released an update that improves pathfinding, reducing cases where routes incorrectly cross water. To achieve this, we now check the localized step instructions on MKRoute.Step, filtering out routes that include water transport terms like “ferry”. Additionally, we refined how Strolly selects route candidates by giving higher weight to parks, beaches, and other pedestrian-friendly locations, increasing the likelihood that generated walks pass through these areas.

Strolly is free to use, and we’re continuing to refine it based on feedback. If you enjoy walking, we’d love to hear what you think!

Screenshots of Strolly on iPhone

Screenshots of Strolly on iPhone


Tech Learnings

Preventing jitter in a custom SwiftUI segmented control

I recently built a custom segmented control for my app EncodeDecode, where I used a matched geometry effect to animate the selection indicator. I wrote about that approach in a blog post – SwiftUI matched geometry effect in a custom segmented control. Later, I added another small effect to improve the visual experience by making the text of the selected option bold.

A straightforward way to achieve this effect is to apply the bold(_:) modifier conditionally based on the selected option.

Text(option.rawValue)
    .bold(option == selectedOption)
    .onTapGesture {
        selectedOption = option
    }

However, this causes a problem when all options are placed in a horizontal stack. Since bold text takes up more space than regular text, selecting an option makes the other options shift slightly, creating an unwanted jitter effect.

To prevent this, I overlaid the bold text, which changes based on selection, on top of a hidden version of the same text that remains bold. This ensures that each option’s space is allocated based on the bold text size, so selecting an option no longer affects the layout. Visually, the text still updates from regular to bold for the selected option while the unselected options remain unchanged.

Text(option.rawValue.capitalized)
    .bold()
    .hidden()
    .overlay {
        Text(option.rawValue.capitalized)
            .bold(option == selectedOption)
    }
    .onTapGesture {
        selectedOption = option
    }

This small adjustment keeps the segmented control looking smooth without any layout shifts when selecting different options.


Blog

SwiftUI Fundamentals: a deeper look into the framework

"SwiftUI Fundamentals" is a new book by Natalia Panferova that explores SwiftUI’s core principles and APIs in depth. It will help you build a solid foundation for using SwiftUI effectively in your projects.

Build a macOS menu bar utility in SwiftUI

Learn how to build a macOS menu bar app in SwiftUI using MenuBarExtra, customize its icon, hide it from the Dock, and add essential features like a quit option.

Testing SceneStorage state persistence in Xcode

Verify SwiftUI app state restoration using the Xcode simulator by following the correct steps, including backgrounding the app and relaunching it.

Capture UUID values with regex in Swift

Build reusable, type-safe components for extracting and validating UUID values using Swift's RegexBuilder framework.

Managing WebSocket messages concurrently with detached actions

Handle multiple concurrent WebSocket messages per connection with Django Channels.


Discounts

Every month, I share exclusive, limited-time offers on my books with email newsletter subscribers. Sign up so you don’t miss future newsletter issues and can take advantage of upcoming discounts!


Subscribe so you don’t miss future issues!

Invalid email address

Unexpected server error

Subscribed!

We take your privacy seriously and will never share your details with third parties.

You can unsubscribe anytime using the link in our emails.

Newsletter RSS feed