Has anyone ever gotten an "Initializer is not impl...
# kotlin-native
d
Has anyone ever gotten an "Initializer is not implemented" error when trying to subclass an Obj-C class?
a
Hello! Have you looked through this paragraph? Maybe the
@OverrideInit
annotation would help here.
d
I think the issue is that the initializer that isn't implemented isn't one inherited from the direct super class, instead it's from the super class of the super class:
Copy code
ObjCSuper (initWithSomething)
^
|
ObjC (does not override initWithSomething)
^
|
Kotlin (initWithSomething not implemented!)
@OverrideInit
does work, but since the missing initializer deals with other native C++ code from an external library, it's not ideal to have to re-implement it in the Kotlin subclass. Is there any way around this?
a
Maybe you can go with something like
Copy code
@OverrideInit constructor(something: Something) : super(something)
?