Hi guys! I have a question, is there any solution ...
# swift-export
s
Hi guys! I have a question, is there any solution in development for integrate pure swift libraries into kmp with full shared ui and logic??
f
Hi, Swift Import is not currently planned, only swift export is currently work in progress.
s
oh shit... so i need to use a library which is built in pure swift, i would need to create a project with shared logic but native ui for android and ios, and then import the library in the ios project is not it?
also i think, even if i have separated UIs, could i use a shared ui??
f
Something like this ?
s
i have alos try ir...
i need to use this library https://github.com/eu-digital-identity-wallet/eudi-lib-ios-wallet-kit.git in kmp, so i use spm but because of being made in pure swift and not having implemented @objc and @objcMembers, spm is not able to convert the library into usable code in kotlin
only happen with these library, i have tryied other libraries and it works fine
f
You can also inject your Swift Code into your KMP library with interface/protocol.
s
i have try cocoapods also, creating my own podspec pointing to that repo but always i face the same issue, kotlin is not able to convert the swift code, that's why im asking if there is any solution for that problem in development
f
My gradle plugin should help you to use this Pure Swift library. In all case, you need to create a bridge Kotlin <-> OBJC <-> Swift to use a pure Swift Library.
The other solution is injecting your Pure Swift library into your shared library by using an interface/protocol.
1
s
i have already tried with your plugin... so i do know if im implementing in the right way... would you like to test and see the problem with your plugin?
thanks a lot François for answer
f
Yes, everything who can help me to improve it is welcomed 😄
s
the problem with your pulign is that if the pure swift code is not annotated with @objc and NSObject, kmp is not able to transform the classes from the swift library
let me adjust some details of the repo and i will share you to you to test 🙂
f
Please read the documentation, you must create a bridge/wrapper for importing a pure swift library.
s
okey could you indicate me where exactly? i have read all the docs but i have not found any solution 😞
that is my main problem, the library has not implemented this so i cannot access from kotlin code
thanks anyway 🙂
f
No that’s the one
s
okey let me try again
h
I have no idea but this Kotlin library sounds like it’s implementing the standard too: https://github.com/a-sit-plus/eu-pid-credential https://github.com/a-sit-plus/vck @Bernd Prünster
s
ohh awesome
thanks @hfhbd
🎉 1
going to try everything you shared with me guys, i will keep you up to date
hi @François https://github.com/sergio-27/TestKmpWithSpm.git here is one example, your plugin is working good, it gets the library from the repo, but im not able to use the libraries exported from composeApp/src/iosMain/kotlin/org/kmp/spm/MainViewController.kt , i think the reason is what i was saying before, that the libraries do not implement @objc approach... test it yourself in my repo and see what problem im having
here you can see that if i use sdk from firebase, the plugin is able to import firebase methods
f
@sergio You must create yourself the bridge to wrap your Swift code into an ObjC compatible code. The plugin help you to import this bridge
🥲 1
b
@hfhbd Hey! Yes, we provide a set of credentials, for use with VC-K over at our credentials collection repo. You can use them to natively support EUDIW functionality on JVM, iOS and Android. While we don't publish it any more, exporting an XC framework of VC-K (to use it in Swift projects) works perfectly (and usability from Swift is something we strive for). I am a little confused though, how VC-K and our verifiable credentials relate to this discussion…
s
thanks @François this solution was my last option but i think i will need a different approach until this issue is solved or i dont know, maybe ios eudi wallet developers, adapt the code to be able to use @objc and NSObject
f
@sergio No, it’s not possible at all
s
i hope they or you guys find a solution for that, would be a huge nice to have hahaha
thanks for your work 🙏
b
@sergio i must have overlooked the note about eudiw. while i have no official confirmation. the native swift reference implementation of the EUDIW code only targets swift, and there's no objc interop planned
h
@Bernd Prünster it’s not related to this technical discussion but I thought it’s related to the use-case of Sergio because he ultimately wants to use the eudi wallet lib, like vck? 😅
s
i confirm that, i have been like one week trying to implement the eudiw lib in kmp project using cocoapods with custom podspec, i have try spm4kmp also and nothing...
b
yeah, i overlooked that. @sergio just PM me, maybe we already have you covered with our libraries
s
so i will use a different approach
thank you all guys!!