Back to Trending
RepositoryKotlinPTPortugal
RA

raamcosta/compose-destinations

Annotation processing library for type-safe Jetpack Compose navigation with no boilerplate.

3.4kstars
144forks
52issues
4views

🧭 Compose Destinations: Điều hướng Jetpack Compose type-safe, hết sạch boilerplate

Chỉ cần annotation, mọi thứ còn lại tự sinh — không route string, không NavType, không bundle thủ công.

Compose Destinations là thư viện Kotlin dùng KSP xử lý annotation để sinh code điều hướng dựa trên Official Jetpack Compose Navigation. Thay vì viết hàng loạt code lặp lại và dễ sai, bạn chỉ cần đánh dấu các Composable screen bằng @Destination và để thư viện lo phần còn lại. API gần giống Jetpack Navigation gốc, không cần học framework mới.

✨ Điểm nổi bật

  • Navigation arguments type-safe: Khai báo tham số trực tiếp trong function Composable — Int, String?, Boolean, Parcelable, Serializable, Enum, @Serializable, cả Array/ArrayList đều hoạt động ngay.
  • Tự sinh Destination classes: Sau khi build, mỗi screen có một class riêng với invoke nhận đúng kiểu argument — gọi ProfileScreenDestination(id = 7, groupName = "Kotlin") là điều hướng xong.
  • Cấu hình navigation graph linh hoạt: Dùng @Destination<RootGraph> hoặc tự định nghĩa graph riêng; file NavGraphs sinh tự động.
  • Navigate back kèm kết quả: Trả dữ liệu về màn hình trước một cách type-safe, không cần xử lý bundle thủ công.
  • Lấy argument từ SavedStateHandle và NavBackStackEntry: An toàn kiểu dữ liệu, tiện khi dùng ViewModel.
  • Hỗ trợ animation, bottom sheet screens, deep linking: Tất cả tính năng của Jetpack Navigation gốc, nhưng đơn giản và an toàn hơn.
  • Wear OS support: Dùng được trên đồng hồ thông minh từ phiên bản 1.x.30.
  • Destination wrappers: Tái sử dụng logic Compose cho nhiều màn hình.

💡 Vì sao đáng chú ý

Điểm mạnh nhất là loại bỏ hoàn toàn phần code dễ sai: route string, NavType, bundle, arguments mapping. Thư viện sinh tất cả từ annotation, nên khi đổi tên hay thêm argument, compiler bắt lỗi ngay — không còn lỗi runtime do sai chuỗi route hay sai kiểu dữ liệu. API quen thuộc với người dùng Jetpack Navigation, nên học nhanh, migrate dễ.

Phù hợp cho dự án Android Compose cần điều hướng nhiều màn hình, đặc biệt khi có argument phức tạp hoặc nhiều nav graph. Bản v2 đã ra mắt với migration guide và docs đầy đủ, cộng đồng hỗ trợ qua Slack.


#KSP #JetpackCompose #Android #Navigation #TypeSafe #TiniX

Similar Projects

Discover other similar projects and AI models.

RepositoryKotlin
gkd-kit/gkd

基于无障碍,高级选择器,订阅规则的自定义屏幕点击安卓应用 | An Android APP with custom screen tapping based on Accessibility, Advanced Selectors, and Subscription Rules

45.3k
Nov 13, 2026
RepositoryKotlin
JunkFood02/Seal

🦭 Video/Audio Downloader for Android, based on yt-dlp

31.0k
Sep 25, 2026
RepositoryKotlin
Heapy/awesome-kotlin

A curated list of awesome Kotlin related stuff Inspired by awesome-java.

11.4k
Nov 22, 2026
RepositoryKotlin
adrielcafe/voyager

🛸 A pragmatic navigation library for Compose Multiplatform

3.1k
Jun 6, 2026
RepositoryJava
termux/termux-app

Termux - a terminal emulator application for Android OS extendible by variety of packages.

65.5k
Nov 5, 2026
RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

475.2k
Nov 23, 2026
RepositoryKotlin
JetBrains/kotlin

The Kotlin Programming Language.

53.6k
Nov 20, 2026
RepositoryKotlin
lysine-dev/okhttp

A meticulous HTTP client for the JVM, Android, and GraalVM.

47.1k
Nov 20, 2026
RepositoryKotlin
square/leakcanary

A memory leak detection library for Android.

30.0k
Oct 21, 2026