Andreas Jost
03/03/2020, 2:08 PMViewContainer
, which is a typealias for View
on Android-side and UIView
on iOS-side. And an extension function ViewContainer.setVisibility(isVisible: Boolean)
. And you also have a second expected class TextField
, which is a typealias for Android EditText
/ iOS UITextField
. EditText
is a subclass of TextView
, which is a subclass of View
. UITextField
is a subclass of UIControl
, which is a subclass of UIView
. So both are related to `View`/`UIView` (ViewContainer
). It would be nice to tell that the compiler, so that you can invoke the function setVisibility()
not only on ViewContainer
, but also on TextField
or other related classes.
Obviously expect class TextField : ViewContainer
won't work, because it isn't a direct child class. So one way is not having a hierarchy and copy/paste the same extension function with the same implementation to TextField
and every View type. But shouldn't there be any better solution?alex009
03/03/2020, 3:13 PM