1 min readJul 6, 2020
This block was copy-pasted from my project, so as long as you have the extension function (and you have viewBinding enabled in Gradle), it should work.
inline fun <T : ViewBinding> AppCompatActivity.viewBinding(
crossinline bindingInflater: (LayoutInflater) -> T) =
lazy(LazyThreadSafetyMode.NONE) {
bindingInflater.invoke(layoutInflater)
}