https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
d

Dmitri Sh

10/24/2019, 1:17 AM
eposting from the general channel, as no answers there- maybe better luck here - this channel looks to be the most appropriate one? A multiplatform project, android and iOS. In common code in Kotlin, I have an interface -
interface Idea
. When in Swift, want to have a struct implement this interface, a.k.a protocol now in the Swiftland. Get a compiler error -
inheritance from non-protocol type 'Idea'.
In the generated objective-c file I see this -
__attribute__((objc_subclassing_restricted))
. Reading on it, all objective c protocols are restricted to classes. So how I do get around this problem - or no getting around and have to use classes in Swift😥?
a

Andrey Chernov

10/24/2019, 4:21 AM
Obj-C protocols are class-bound, so you can implement it only in class “objc_subclassing_restricted” means your class isn’t public in kotlin common code
k

kpgalligan

10/24/2019, 4:28 PM
To directly answer, no structs
d

Dmitri Sh

10/24/2019, 7:07 PM
thanks. my interface is public is Kotlin common code, and I can see it in swift, just can apply to structs, only classes. But I get the point. Have to use Swift classes.
correction - can't apply to structs, only to classes