# ios

Romain Dubreucq

03/02/2020, 4:45 PM
Hello there! Did someone succeed to publish a Kotlin Native library on GitHub with the Cocoapods plugin?
Found a solution, feel free to ask if you need the same

Yernar Mendigarin

09/25/2020, 3:36 PM
Hello, Romain. I am currently trying to publish generated pod into private Git repository. However, getting troubles in doing so. Could you please guide me, step by step how to make it?

Romain Dubreucq

09/25/2020, 3:44 PM
Hello Yernar Sure, the idea is to modify the podspec generated by the K/N cocoapods plugin. Here is an example of my podspec:
Copy code do |spec|                     = 'YourFramework'
    spec.version                  = '1.0.0'
    spec.homepage                 = 'Your homepage'
    spec.source                   = { :git => "your git URL", :tag => "1.0.0" }
    spec.authors                  = ''
    spec.license                  = ''
    spec.summary                  = ''

    spec.ios.deployment_target    = '12.0'
    spec.static_framework         = true

    # Make sure that the binary generated by the K/N compiler is at this path
    spec.vendored_frameworks      = "YourFramework/build/fat-framework/release/YourFramework.framework"
    spec.libraries                = "c++"
    spec.module_name              = "#{}_umbrella"

    spec.pod_target_xcconfig = {
        'KOTLIN_TARGET[sdk=iphonesimulator*]' => 'ios_x64',
        'KOTLIN_TARGET[sdk=iphoneos*]' => 'ios_arm',
        'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x86',
        'KOTLIN_TARGET[sdk=watchos*]' => 'watchos_arm',
        'KOTLIN_TARGET[sdk=appletvsimulator*]' => 'tvos_x64',
        'KOTLIN_TARGET[sdk=appletvos*]' => 'tvos_arm64',
        'KOTLIN_TARGET[sdk=macosx*]' => 'macos_x64'

    # This idea is to tell Cocoapods to build your K/N module with Gradle in the prepare_command

    spec.prepare_command = <<-SCRIPT
    # My build.gradle contains A FatFrameworkTask for debug and release configurations
    # Basically I'm just asking Gradle to execute the releaseFatFramework task

      ./gradlew releaseFatFramework
I left some comments, feel free to ping me directly if you have any question
Note that you don't really need the cocoapods plugin, actually you can just copy paste this podspec and edit it directly 🙂