Can anyone confirm Cocoapods integration (consumin...
# ios
d
Can anyone confirm Cocoapods integration (consuming a Cocoapod) is still working in
2.0.21
? I'm following these instructions; which state to set the
deploymentTarget
using the target name, like this:
Copy code
cocoapods {
    iosArm64.deploymentTarget = "13.5"
}
...but even though I have every Kotlin/KGP version set to "2.0.21", I can't resolve the
iosArm64
symbol here; only plain
ios
i.e
Copy code
cocoapods {
    ios.deploymentTarget = "13.5"
}
I've verified that I'm resolving the
2.0.21
artifact but
iosArm64
is not a member of this extension. What gives? Is the documentation wrong?
In case above post doesn't adequately convey the situation, see below:
👌 1
If
iosArm64
is an extension method; neither the IDE or Documentation hint at it...
Here's the CocoapodsExtension file in Kotlin GitHub for
2.0.21
. Can't understand what the documentation is saying.
Well, everything started working for me with just
ios.deploymentTarget = "16.0"
but I still can't reconcile this with the documentation which just seems wrong.
f
I guess, the documentation has not been well updated, obviously. Anyway, CocoaPods is starting to be kind of sensitive tool. https://blog.cocoapods.org/CocoaPods-Support-Plans/
d
If really rather not use it myself; since it's rather complex, but currently its the only method available to import native iOS libraries
f
it’s not even working properly on xcode 16 and no reaction from the dev.
d
I'd rather use SPM
But only export is supported rn
f
You can do the other way
d
Really! With SPM?
d
Thanks, it moves fast enough that even when I think I'm on top, things still change
f
The manual way, you need to compile yourself the libs or using Carthage if compatible
d
Ok, by manual means get compiled files to correct location for ObjCInterop to take over?
I'll research, thanks for the hint
I thought I'd be stuck without cocapods even though I don't love it
f
• Compile the library you want to import, Carthage can help you
👍 2
• then import the binary with the alternative way
d
Great, then maybe I can still use simpler
embedAndSign
integration path after that ☺️
f
Take care, the alternative will heavily add code to you Gradle file.
👍 1
Cocoapods do a lot of stuff to simplify the integration (not only compilation)
d
Alright, this is a new journey. Hopefully it proves more efficient than Cocoapods
I own the code I'm importing
It's just an ObjC wrapper around Swift only APIs
f
Don’t know if it’s still working
d
Wow, that seems non trivial to build and maintain
Will check it out thx
I thought this couldn't be realistically automated due to Swift language richness
I already created the ObjC wrapper so I may just have the cinterop part to implement
f
It’s not really swift, it’s ObjectiveC
d
Ah ok, so it still needs the wrapper code I've created
f
Yes, still need it. For now, we can’t import swift to Kotlin directly. The ObjC bridge is mandatory.
d
Yep, I'm aware of the direct Swift import feasibility challenge. Thanks so much for mentioning this plugin - it looks aimed at my exact use case - I read the source to be sure I understand what it's doing, looks like: • Perform your native
.xcproj
compilation via
xcrun
• Generate the necessary
.def
file for Cinterop • Enable the above for all supported Apple-platform 'sub-targets' e.g. ios, tvos etc. ...in short, it just takes away the 'heavy Gradle code' you'd otherwise end up hand-cranking.
This plugin seems overall a cleaner solution than Cocoapods/Carthage for simple native import use cases. Happy! ☺️
🙌 1
f
Glade I help! I didn’t know at first it was a personal dependency and not a Third party lib (like Firebase). So, it’s simpler when it comes your own code to import.
👍 1
d
Hmm, I wonder if there is already a community effort to maintain wrappers for the (now very many) Swift ABI only Apple SDKs. I've created a few now out of necessity... It okay but gets a bit boring to do after a while. 🫣 Maybe I'll start one! 🤔💡
Follow up: I tried
swift-klib-plugin
my goodness that was so much easier and more straightforward than Cocoapods integration. Kudos to @Evegenii Khokhlov!