icerockdev / moko-graphics

Graphics primitives for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
25 stars 5 forks source link

Trying to make it work on a new project using KMM plugin #8

Closed nverinaud closed 3 years ago

nverinaud commented 3 years ago

Hi !

I try to make this library work on a new project and I can't get my head around it.

On Android and in the multiplatform library it works like a charm but I cannot get toUIColor() method work on iOS in swift.

I made a sample project demonstrating the issue : https://github.com/nverinaud/SampleMokoGraphics.

Could you please help me make it work ?

It seems like the iOS specific code of the library is not exposed in the resulting multiplatform framework.

Thanks !

Alex009 commented 3 years ago

hi! to export dependencies classes to ios framework you should use https://kotlinlang.org/docs/reference/mpp-build-native-binaries.html#export-dependencies-to-binaries

here it in sample: https://github.com/icerockdev/moko-graphics/blob/master/sample/mpp-library/build.gradle.kts#L17

nverinaud commented 3 years ago

Thanks @Alex009 ! I managed to make it work by exporting the library transitively.

I think it could be helpful to update the README with these instructions unless you consider that it is "basic" KMM knowledge.