robinchew
10/25/2018, 9:13 AMval manyFunctions: ArrayList<(View) -> Unit> = arrayListOf(
{layout: TextView -> Unit}
)
But that don't work cos TextView is not exactly View though it subclasses it.Dominaezzz
10/25/2018, 9:20 AMView to out View or in View. I don't remember which will work but one should.diesieben07
10/25/2018, 9:21 AMView, it only accepts TextView. How do you intend to even call these functions? You can't.
@Dominaezzz That does not work in a function type (it's not really useful, the parameters are always in, the return type is always out).Dominaezzz
10/25/2018, 9:23 AMrobinchew
10/25/2018, 9:27 AMDominaezzz
10/25/2018, 9:27 AMrobinchew
10/25/2018, 9:28 AMdiesieben07
10/25/2018, 9:28 AM{ foo: out Thing -> Unit } there is no way to call it, since you cannot know what it's actual parameter is.robinchew
10/25/2018, 9:29 AMDominaezzz
10/25/2018, 9:29 AMTextView, you'll get a ClassCastException or similar. Given it compiles.diesieben07
10/25/2018, 9:30 AMrobinchew
10/25/2018, 9:31 AMrobinchew
10/25/2018, 9:40 AMArrayList<(View) -> Unit>
I tried to do:
ArrayList<((Context) -> View) -> Unit>
But that's a syntax errorrobinchew
10/25/2018, 9:40 AMView for (Context) -> View.robinchew
10/25/2018, 9:42 AMrobinchew
10/25/2018, 9:43 AM