epoxy-adapter / com.airbnb.epoxy / EpoxyController / moveModel

moveModel

open fun moveModel(fromPosition: Int, toPosition: Int): Unit

An optimized way to move a model from one position to another without rebuilding all models. This is intended to be used with androidx.recyclerview.widget.ItemTouchHelper to allow for efficient item dragging and rearranging. It cannot be

If you call this you MUST also update the data backing your models as necessary.

This will immediately change the model's position and notify the change to the RecyclerView. However, a delayed request to rebuild models will be scheduled for the future to guarantee that models are in sync with data.

Parameters

fromPosition - Int: Previous position of the item.

toPosition - Int: New position of the item.