Hello there I am currently experimenting with cros...
# swift-export
d
Hello there I am currently experimenting with cross-language inheritance with 2.4.20 For the similar code:
Copy code
// Kootlin
interface MyKotlinController {
    fun handle()
}
// Swift
class MySwiftController: KotlinBase, MyKotlinController {
    func handle() {
    }
}
let controller = MySwiftController()
I have the compilation error: 'init()' is unavailable Does anyone have ideas?
✅ 1
r
Hey! This is a known issue. Please keep an eye on https://youtrack.jetbrains.com/issue/KT-88251
thank you color 3
a
I'll just highlight that there is a workaround - one can define a new open class that would be used as inheritance base - like this issue demonstrates. There is a bug in this approach, also listed in that issue 🙂 The good news - it works as expected in release mode.
thank you color 1
d
@Artem Olkov Thank you for the workaround idea, but unfortunately it doesn't work in my case:
Copy code
@objcMembers final class MySwiftController: SwiftBase, MyKotlinController {
   ...
}
Implicit initializer 'init()' with Objective-C selector 'init' conflicts with initializer 'init()' from superclass 'KotlinBase' with the same Objective-C selector
a
Just out of curiosity - What drove you to write
@objcMembers
? If there is a suggestion to do that somewhere in our docs I would love to remove that. I've just added the example from the docs here - github.com/Kotlin/swift-export-sample/…/inheritance_demo It works both in release and debug modes.
d
I need to double check, but as I remember it's needed to call the controller from ObjC code (we still have a lot of legacy objective C in our iOS app project)