I have an interface:
interface Foo {
fun doSomething()
}
I have several classes that implement this interface. I also have a class, FooWrapper:
class FooWrapper(var delegate: FooImpl?) : Foo by delegate // doesn't work
Is it possible to use a nullable type there? Basically, I want to retain an instance of FooWrapper
forever as a singleton, but switch out its delegate based on certain events, for magical Android reasons. Without this, I have to hand-write the delegation code.
Thanks!