Hello! I'm trying to access ios library registered...
# multiplatform
u
Hello! I'm trying to access ios library registered as SPM in kotlin native. Where can I find the example sample code? Thank you!
f
I'm looking for the same thing.
a
f
That demo works for SMP packages that support Objective-C
If SPM supports pure Swift, it doesn't work
y
I used the library with pure swift via an interface from the shared module . The interface was implemented in swift iOS module and injected with koin DI. As an alternative, swiftklib library can be used, but I haven't tried it
f
Does it require the source code of SPM add @obj ? @Yevhen Shcherbyna
image.png
y
If we're talking about the library. @obj annotations are required in the files that you use as wrappers for pure swift files. You can see a sample with the CryproKit library inside. Also, you can find more information here https://medium.com/@stevdza-san/cinterop-from-swift-to-kotlin-complete-guide-8814b005b9a8
👀 1
f
I'm looking for a solution that can allow Kotlin works directly with Swift, do not require to implement Objective-C wrapper for Swift Package. Because I have many Swift Packages and too many classes and functions. It will take a lot of time to implement wrappers