Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
inline fun <reified T : Parcelable> createParcel(
crossinline createFromParcel: (Parcel) -> T?): Parcelable.Creator<T> =
object : Parcelable.Creator<T> {
override fun createFromParcel(source: Parcel): T? = createFromParcel(source)
override fun newArray(size: Int): Array<out T?> = arrayOfNulls(size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment