I was wondering if there was a way to alleviate this problem I’m having with kotlin/swift interoperability.
I have a generic interface in Kotlin
interface Repository<T> {
fun add(model: T): Boolean
}
I have another interface that conforms to `Repository`:
interface TestModelRepository : Repository<TestModel> {
override fun add(model: TestModel): Boolean
}
When I have a class in Swift that conforms to
TestModelRepository
class SwiftTestModelRepository: TestModelRepository
it wants me to implement both
add
methods. One with type
id
and one with type
TestModel
. I only want to implement one of them.
Is there a workaround for this where I only implement the overridden one from
TestModelRespository
and not from the generic Repository?
As a backup I can only declare
add
in
TestModelRepository
and remove it from
Repository
but this will make the code less clean as I want to have many more repositories that conform to
Repository
and would like to reuse the
add
method.