I was trying to create an extension function to create object of view holder for recycler view adapter
inline fun <reified T: RecyclerView.ViewHolder> ViewGroup.createViewHolder(@LayoutRes res: Int): T {
val inflater = LayoutInflater.from(context)
val itemView = inflater.inflate(res, this, false)
// return ViewHolder Object
}
How do I create an object of the type T that extends RecyclerView.ViewHolder so that I can return from the function.
::
(function reference)? I didn't know that, cool! – Pelpel