🚧 Manage SwiftUI Navigation using the Router Pattern 🚌

November 10, 2024

Welcome to the issue #21 of the iOS Coffee Break Newsletter 📬.

Views on SwiftUI's navigation are divided: some developers support it fully, while others feel it is not yet robust enough for complex apps, even with NavigationStack.

This week, I published an article introducing the Router pattern in SwiftUI, explaining why it is beneficial and how to implement it effectively. The Router pattern helps you keep navigation logic separate from your views, making your app more maintainable and scalable in the long run.

The Router approach, ideal for programmatic and adaptable navigation, offers significant flexibility. It is particularly effective for apps with complex or conditional navigation flows, allowing developers to structure navigation tailored precisely to the app's requirements.

If you are only interested in the code, here is the GitHub repository.

Here is a quick demo from the sample project I have set up:

The navigation router could be enhanced to handle other types of transitions, like sheet presentations or full-screen views, in addition to the navigation stack. I am planning to add these features over the next few weeks — stay tuned!

Now it is time to dive into some iOS development topics submitted by the community. Here are this week's highlighted resources. Hope you enjoy 🙌.

✍️ Automate Apple app code signing using fastlane match

Pol's article offers a friendly guide to automating code signing with Fastlane Match, covering the basics and providing a step-by-step tutorial. This can be a huge time-saver, especially for large teams, as it helps avoid redundancy and streamlines updates to signing identities when adding devices or new team members.

For teams managing certificates manually or through automation, it is a highly recommended read to minimize potential confusion and improve efficiency.

🫙 Developing in Swift with VS Code Dev Containers

Imagine if we could eliminate the "it works on my machine" issue entirely 🤔!

In the first of a three-part series, Natan from Swift Toolkit walks through using VS Code, Dev Containers, and GitHub Codespaces to develop and debug Swift applications on Linux.

This article provides a practical guide on setting up VS Code on your local machine with Dev Containers, enabling a smooth Swift development and debugging experience across environments.

🧙‍♀️ Bringing Tuist Previews forward

Testing the application is a vital part of the development process, catching bugs 🐛 early makes them easier to locate and resolve.

With Tuist's latest preview enhancements, launching the app from any branch, specific commit, or the latest repository update is now just one command away. I am definitely thrilled to give this feature a try!

tuist run App@latest # run latest preview from you default branch
tuist run App@feature-branch # run preview from a specified branch
tuist run App@91eb7c # run preview from a specific commit