setVisibleIf

fun View.setVisibleIf(condition: Boolean?)

Sets the visibility of the View based on whether the condition is satisfied. If the condition is satisfied (true), the visibility is set to View.VISIBLE. Otherwise, it is set to View.GONE. If condition is null, it is set to View.GONE.

This adapter allows replacing

<View
android:visibility="@{viewModel.condition ? View.VISIBLE : View.GONE}" />

with

<View
auto:visibleIf="@{viewModel.condition}" />