22
33[ ![ CI] ( https://github.com/mercari/nav-entry-scope-android/actions/workflows/ci.yml/badge.svg?branch=main )] ( https://github.com/mercari/nav-entry-scope-android/actions/workflows/ci.yml )
44[ ![ License: MIT] ( https://img.shields.io/badge/License-MIT-yellow.svg )] ( LICENSE.txt )
5+ [ ![ Latest version (lib)] ( https://img.shields.io/maven-central/v/com.mercari/nav-entry-scope?label=nav-entry-scope )] ( https://central.sonatype.com/artifact/com.mercari/nav-entry-scope )
6+ [ ![ Latest version (processor)] ( https://img.shields.io/maven-central/v/com.mercari/nav-entry-scope-processor?label=nav-entry-scope-processor )] ( https://central.sonatype.com/artifact/com.mercari/nav-entry-scope-processor )
57![ Android] ( https://img.shields.io/badge/Platform-Android-green.svg )
68![ API] ( https://img.shields.io/badge/API-24%2B-brightgreen.svg )
79![ Kotlin] ( https://img.shields.io/badge/Kotlin-2.0-blue.svg )
@@ -32,7 +34,20 @@ Use NavEntryScope when you have:
3234
3335## How to Use
3436
35- ### 1. Annotate Shared Dependencies
37+ ### 1. Add Dependencies
38+
39+ Add the library and annotation processor to your module's ` build.gradle.kts ` :
40+
41+ ``` kotlin
42+ dependencies {
43+ implementation(" com.mercari:nav-entry-scope:<version>" )
44+ ksp(" com.mercari:nav-entry-scope-processor:<version>" )
45+ }
46+ ```
47+
48+ Replace ` <version> ` with the latest version shown in the badge above.
49+
50+ ### 2. Annotate Shared Dependencies
3651
3752``` kotlin
3853@Module
@@ -45,7 +60,7 @@ interface YourModule {
4560}
4661```
4762
48- ### 2 . Inject into ViewModels
63+ ### 3 . Inject into ViewModels
4964
5065ViewModels remain standard ` @HiltViewModel ` classes. Injecting a dependency that depends on ` @NavEntryScoped ` into your ViewModel is also supported.
5166
@@ -56,7 +71,7 @@ class YourViewModel @Inject constructor(
5671) : ViewModel()
5772```
5873
59- ### 3 . Use in Compose
74+ ### 4 . Use in Compose
6075
6176Replace ` hiltViewModel() ` with ` navEntryScopedViewModel() ` :
6277
@@ -92,6 +107,38 @@ Annotation processor (KSP) that generates:
92107- ` NavEntry_EntryPoint ` - Hilt EntryPoint interface installed in ` NavEntryComponent `
93108- ` NavEntry_Module ` - Dagger module installed in ` ViewModelComponent ` that provides NavEntryScoped dependencies
94109
110+ ## Local Development
111+
112+ ### Testing Changes Locally
113+
114+ To test library changes immediately in the sample app, publish to Maven Local:
115+
116+ ``` bash
117+ ./gradlew publishToMavenLocal
118+ ```
119+
120+ The sample app is already configured to use ` mavenLocal() ` , so changes will be picked up on the next build.
121+
122+ ### Using Snapshots
123+
124+ To use snapshot versions of the library, add the snapshot repository to your ` settings.gradle.kts ` :
125+
126+ ``` kotlin
127+ dependencyResolutionManagement {
128+ repositories {
129+ maven(" https://central.sonatype.com/repository/maven-snapshots/" )
130+ mavenCentral()
131+ }
132+ }
133+ ```
134+
135+ Then use the snapshot version in your dependencies:
136+
137+ ``` kotlin
138+ implementation(" com.mercari:nav-entry-scope:<version>-SNAPSHOT" )
139+ ksp(" com.mercari:nav-entry-scope-processor:<version>-SNAPSHOT" )
140+ ```
141+
95142## Contribution
96143
97144If you want to submit a PR for bug fixes or documentation, please read the [ CONTRIBUTING.md] ( CONTRIBUTING.md ) and follow the instruction beforehand.
0 commit comments