问题
I'm a bit rusty with protocol composition in Kotlin, I'd just like to combine multiple interfaces by declaring a custom typealias
:
// This doesn't work
typealias MyType = (ReadableInterface && WritableInterface)
Any ideas?
In Swift, I would do it this way:
typealias MyType = ReadableInterface & WritableInterface
In Objective C, I would do it this way:
typedef <ReadableInterface, WritableInterface> MyType;
回答1:
Why not just create new interface?
interface MyType : ReadableInterface, WritableInterface
来源:https://stackoverflow.com/questions/59044121/typealias-combine-multiple-interfaces-in-kotlin