https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
b

brabo-hi

02/09/2023, 7:32 PM
Hi guys, how can we package the shared module into an ios library that can be consumed as cocoapod
l

Landry Norris

02/09/2023, 7:40 PM
Apply the cocoapods plugin, and it will create a podspec and a framework output. You can set a publishDir in the cocoapods configuration to create a publish task (writes the podspec and framework to publishDir). My team has a script that runs the publish task, then copies the contents of publishDir to another git repo and pushes it.
b

brabo-hi

02/09/2023, 7:45 PM
Thanks, that would be great it you could share samples on how to do it
l

Landry Norris

02/09/2023, 7:53 PM
I can’t find any tutorials on this, but the config for publishing is
Copy code
//Publish locally by calling ./gradlew podPublishXCFramework
publishDir = File(rootDir, "pod")
in the cocoapods block. This will produce a podspec and xcframework for you (release and debug). Just copy the files wherever they’re needed depending on how you set up cocoapods.
I believe this is roughly how KMMBridge works if you want to set that up, but I haven’t used it yet.
b

brabo-hi

02/09/2023, 8:26 PM
thanks, will check it
6 Views