Following the <Add dependency on a pod library> gu...
# ios
b
Following the Add dependency on a pod library guide, I am not able to add
MapboxMaps 10.13.1
as a dependency to
iosMain
module; I cannot import
cocoapods.MapboxMaps.*
. Using the same instructions, I am able to successfully add
Nuke 10.5.2
as a dependency to
iosMain
and import
cocoapods.Nuke.*
What's the difference between
MapboxMaps
and
Nuke
that allows one library to be used as an
iosMain
dependency but not the other?
I forked the multiplatform template project to reproduce the issue here
c
According to this MapBox requires an access token for you to be able to pull the code
IMG_0454.png
b
Yes, I have a
.netrc
file defined. I am using mapbox in my ios native code and android native code without issue. The problem I have is I am unable to reference the mapbox library within the
shared/iosMain
module. And this manifests itself as an inability to import
cocoapods.MaxboxMaps.*
but does not produce any error message when synchronizing/importing project.
i
In order to use MapBox pod in iosMain, you shouldn't add it to the Podfile, but instead add it to cocoapods block as pod("MapboxMaps"), that will generate interopbindings. Also, be aware that at the moment kotlin doesn't support pure swift only pods, only objective-c ones.
b
@iXPert12 if you check the reproduction sample I put up, that's exactly what I do
Kotlin/Native provides bidirectional interoperability with Objective-C. Objective-C frameworks and libraries can be used in Kotlin code if properly imported to the build (system frameworks are imported by default). See compilation configurations for more details. A Swift library can be used in Kotlin code if its API is exported to Objective-C with
@objc
. Pure Swift modules are not yet supported.
good callout on swift interop though
not even trying to think about what the ARC implications are yet, but I am managing to pass in a mapbox view from swift to a compose component and render within
UIKitView
as a workaround