Android-view
Skip if you are using Compose.
Since the static applicationContext could be provided, dependency injection is not so needful on Android now. Use this tracer extension if you are familiar with tracer and interested.

Setup #

Add this dependency below tracer-compiler.

// Never put this above 'tracer-compiler'
ksp ("io.github.shawxingkwok:tracer-android-view-compiler:1.0.0-1.0.0")

Effect #

Connects with activity/parentFragment’s interior elements with automatic requireActivity/requireParentFragment.


Generated code

For the example of public SharedViewModel in MainActivity, I suggest annotating the subclass of ViewModel with Tracer.Tip to avoid tracing insides.

GitHub repo #