rememberSwipeableStateFor

fun <T : Any> rememberSwipeableStateFor(value: T, onValueChange: (T) -> Unit, animationSpec: AnimationSpec<Float> = AnimationSpec): SwipeableState<T>

Create and remember a SwipeableState which is kept in sync with another state, i.e.:

  1. Whenever the value changes, the SwipeableState will be animated to that new value.

  2. Whenever the value of the SwipeableState changes (e.g. after a swipe), the owner of the value will be notified to update their state to the new value of the SwipeableState by invoking onValueChange. If the owner does not update their state to the provided value for some reason, then the SwipeableState will perform a rollback to the previous, correct value.