Skip to content

Instantly share code, notes, and snippets.

@gabrielbmoro
Last active January 22, 2022 22:40
Show Gist options
  • Save gabrielbmoro/fe77f977f32c591c62b78a4e4162cbc8 to your computer and use it in GitHub Desktop.
Save gabrielbmoro/fe77f977f32c591c62b78a4e4162cbc8 to your computer and use it in GitHub Desktop.
NavQuizType - Argument - Navigation Compose
class NavQuizType: NavType<Quiz>(false) {
override fun get(bundle: Bundle, key: String): Quiz {
return bundle.getParcelable(key)!!
}
override fun parseValue(value: String): Quiz {
return Gson().fromJson(value, Quiz::class.java)
}
override fun put(bundle: Bundle, key: String, value: Quiz) {
bundle.putParcelable(key, value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment