Member-only story

Jetpack Compose Navigation: Embracing Type Safety and Simplifying Parcelable Handling with NavHelper library

Ioannis Anifantakis
7 min readJun 14, 2024

--

Resources

Full video tutorial: YouTube

At the above video you can watch how to embrace the new type safety provided by the new navigation libary, utilizing DataClass to pass parameters, and how to fully add Parcelables. Then the video shows a simplification using the NavHelper library to pass your parcelables with almost no effort, almost as if Parcelables were primitives.

NavHelper Library at GitHub

Old way passing Parcellables through BackStack: GIST
New way passing Parcellables through BackStack: GIST

Demo Project at GitHub

Introduction

A crucial aspect of crafting seamless user experiences in Jetpack Compose is navigation, and with the release of Jetpack Compose Navigation 2.8.0-alpha08, we’ve witnessed a significant shift towards a more robust and type-safe approach, as announced at Google I/O ‘24.

In this article, we’ll delve into the world of type-safe navigation in Jetpack Compose, with a focus on passing Parcelables, and introduce a handy helper library, NavHelper, designed to simplify your navigation code.

--

--

Responses (1)