Shawn11/29/2018, 2:56 AM
but a) that probably won’t work, b) why do you need this as a function?
inline fun <reified T> Any.castTo() = this as T
tyjka11/29/2018, 3:02 AM
looks more fluid to me than
Later is more idiomatic though.
(holder as NetworkStateViewHolder).bindTo(networkState)
Shawn11/29/2018, 3:15 AM
tyjka11/29/2018, 3:32 AM
Shawn11/29/2018, 3:35 AM
if the class cast fails, you’ll just have to switch from the function to
anyhow or add an additional
(foo as? bar)?.baz()...
tyjka11/29/2018, 4:21 AM