We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The idea was took from https://medium.com/@BladeCoder/reducing-parcelable-boilerplate-code-using-kotlin-741c3124a49a.
If you have an internal KParcelable then:
KParcelable
describeContents
interface KParcelable : Parcelable { override fun describeContents() = 0 override fun writeToParcel(dest: Parcel, flags: Int) }
inline fun <reified T> parcelableCreator(crossinline create: (Parcel) -> T): Parcelable.Creator<T> { return object : Parcelable.Creator<T> { override fun createFromParcel(source: Parcel) = create(source) override fun newArray(size: Int) = arrayOfNulls<T>(size) } }
to write simpler creators:
companion object { @JvmField val CREATOR: Parcelable.Creator<RealEstate> = parcelableCreator(::RealEstate) }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The idea was took from https://medium.com/@BladeCoder/reducing-parcelable-boilerplate-code-using-kotlin-741c3124a49a.
If you have an internal
KParcelable
then:describeContents
everywhere.to write simpler creators:
The text was updated successfully, but these errors were encountered: