package es.verdnatura.presentation.common

import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
import androidx.databinding.BindingAdapter
import org.koin.core.KoinComponent

object BindingAdapter : KoinComponent {

    /**
     * Set view visibility depending boolean
     *
     * @param isVisible - If true, set view to VISIBLE, else set view to GONE
     */
    @BindingAdapter("isVisible")
    @JvmStatic
    fun View.isVisible(isVisible: Boolean) {
        visibility = if (isVisible) VISIBLE else GONE
    }

}
