Closed isalig closed 3 years ago
Please, provide code sample
We save view state in onSaveInstanceState sometimes. Of course this is not the best solution, but it's already written at many places. And Kotlin synthetics were providing safe view access like view?.doSomething()
. Can we do something like binding.view?.property
. It could make migration easier for projects with code like that:
override fun onSaveInstanceState(outState: Bundle) {
recyclerView
?.layoutManager
?.onSaveInstanceState()
?.let { state -> outState.putParcelable(SCROLL_STATE_KEY, state) }
super.onSaveInstanceState(outState)
}
ViewBinding generated by Android Gradle Plugin. I can't change it
And what about nullable ViewBinding property?
It will break the work of the library for users. You can make a fork and do what you need
Can we access views in safe style via Elvis operator? It could be helpful in some cases during migration from Kotlin synthetics