Rohan Maity
06/30/2022, 7:03 AMYoussef Shoaib [MOD]
06/30/2022, 7:06 AMvar myGlobalVariable: KClass<*>? = null
// In your reified function
myGlobalVariable = T::class
I believe there's also typeOf<T>()
which gives you a KType
instead but I can't remember if that's the right syntax for it or notRohan Maity
06/30/2022, 8:16 AMfragment<MyVariable>()
Actual usage
fragment<HomeFragment>
But this variable thing does not work hereribesg
06/30/2022, 9:18 AMYoussef Shoaib [MOD]
06/30/2022, 9:30 AMRohan Maity
06/30/2022, 9:39 AMribesg
06/30/2022, 9:41 AMval U = _somethingWithT_
someGenericFunction<U>()
And that is entirely impossible as the first instance of ‘U’ here represents a variable, something that exists at runtime, while the second instance of ‘U’ represents something that doesn’t exists at runtime. It’s like two different universes that don’t meet, nothing can be in bothRohan Maity
06/30/2022, 4:39 PM