Does anyone have documentation about wrapping and modifying Swift
structs
from multiplatform code?
k
kpgalligan
07/05/2019, 5:59 PM
Do you mean passing them into MP code, or being able to consume output as structs? I’ve thought about this topic a lot.
👍 1
a
alex.hart
07/05/2019, 6:22 PM
It would be passing them to / creating / manipulating them from an MP wrapper type, basically.
k
kpgalligan
07/05/2019, 7:21 PM
Passing in, I think the first question is what do you do with Objc now? I’ve been more focused on getting structs from Kotlin I guess and haven’t thought about passing them in as much. As all Kotlin interop is through Objc currently, you’d be limited to that class of approach. Something like this perhaps: https://stackoverflow.com/a/35049855/227313
In general, when expecting something from Swift passed into Kotlin, it’ll be defined as an interface in Kotlin which is translated to a protocol, but it’s a “class protocol”. You can’t implement it with a struct.
Summary, it’ll be wrapping or converting into classes