Hi there. How can I call Cocoapods library from iO...
# multiplatform
h
Hi there. How can I call Cocoapods library from iOSMain common code? I want to write a wrapper for socket io using expect/actual and just don't know how to import iOS side Socket IO dependency into Kotlin code
m
h
I have seen that link. It's not really helping
Screenshot 2023-05-01 at 08.25.50.png
a
Is a gradle sync successful in your case? Are there any warnings or errors?
h
Gradle sync is successful but cocoapods import is not available
a
Can you share the build script or maybe the full project?
h
you mean build.gradle file?
a
Yes
h
sure. sharing files right now. here's my podfile.
this is shared build.gradle file
root build.gradle file.
is there any other file that you need?
kotlin.mpp.enableCInteropCommonization=true
is enabled in
gradle.properties
file
a
You should add pod-dependency to cocoapods block of the build.gradle not to the podfile
h
just added but no luck. still cocoapods can't be linked from iOSMain
a
And still no warnings/errors during sync?
h
only this nothing else
a
There should be smth like
fatal error: module 'Socket' not found
This can be fixed by adding
moduleName
to the dependency declaration, like this:
pod("Socket.IO-Client-Swift", version = "15.2.0", moduleName = "SocketIO")
h
there isn't any errors but after adding module name it became visible with semi/autocompletition.
I consider this as a win thank you @a-dd