icerockdev / moko-kswift

Swift-friendly api generator for Kotlin/Native frameworks
https://moko.icerock.dev
Apache License 2.0
352 stars 22 forks source link

How can I implement SealedToSwiftEnumFeature for xcframework? #75

Open Fostahh opened 1 year ago

Fostahh commented 1 year ago

So I've created a KMM Library project, not KMM App project. I've follow all the steps in your Github Readme and Medium How to implement Swift-friendly API with Kotlin Multiplatform Mobile. I've created the sealed class image And after I generate it into XCFramework ./gradlew assembleXCFramework, the sealed class still convert into this

image

Am I doing it wrong? If you wanted to check out my code, here's the repository https://github.com/Fostahh/MySharedKMMLibrary

Alex009 commented 1 year ago

@Fostahh generated swift code not part of xcframework. swift code located in build directory. check this sample - https://github.com/Alex009/moko-kswift-usage-sample/commit/fc921315acb4baa06cbb6038bcd77a639cb329b0

Fostahh commented 1 year ago

@Alex009 thank you so much for replying! But in my case, I don't have any iosApp or androidApp module in this KM Lib Project since I'm going to use this as a library or SDK. Then, I'm going to link this KM Library/SDK into my existing Xcode project. Is this possible to implement sealed class for my case?

Fostahh commented 1 year ago

I already have the generated swift code by kswift like this image

Build the xcframework and link it into my Xcode project. Then copy the generated swift code file into my Xcode project too. The result is like this

image

Since the function returns this

image image