Created
December 21, 2021 21:37
-
-
Save Kvest/431160df310eeaa012d3a35fcc19ddfb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AndroidEntryPoint | |
class SomeFragment : Fragment(R.layout.fragment_some) { | |
companion object { | |
fun newInstance(someId: String): SomeFragment { | |
val instance = SomeFragment() | |
instance.arguments = bundleOf( | |
SomeViewModel.KEY_SOME_ID to someId | |
) | |
return instance | |
} | |
} | |
} | |
@HiltViewModel | |
class SomeViewModel @Inject constructor( | |
savedStateHandle: SavedStateHandle | |
) : ViewModel() { | |
companion object { | |
const val KEY_SOME_ID = "some_id" | |
} | |
private val someId = savedStateHandle.get<String>(KEY_SOME_ID) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment