Skip to content

Instantly share code, notes, and snippets.

@tareq3
Last active July 12, 2022 12:46
Show Gist options
  • Save tareq3/fad514482d05de2c85177c809cb9c654 to your computer and use it in GitHub Desktop.
Save tareq3/fad514482d05de2c85177c809cb9c654 to your computer and use it in GitHub Desktop.

Deploy xcframwork to cocoapod

Step 1: make sure cocoapod is installed

Step 2: prepare your xcframework

Step 3: create a remote public github repo and clone that to your any folder location.

example: https://github.com/tareq3/RandomCarsFramework

Step 4 : Copy xcFramework to the github_repo

Step 5: Add framweworkName.podspec in that github_repo

Step 6: edit podspec like below:

Pod::Spec.new do |spec|
  spec.name         = 'RandomCars'
  spec.version      = '0.2'
  spec.license      = { :type => 'MIT' }
  spec.homepage     = 'https://github.com/tareq3/'
  spec.authors      = { 'Tareq' => 'mti.tareq3@gmail.com' }
  spec.summary      = 'Random Cars generator'
  spec.source       = { :git => 'https://github.com/tareq3/RandomCarsFramework.git', :tag => spec.version.to_s }
  spec.requires_arc = true
  spec.ios.deployment_target    = '10.0'
  spec.xcconfig = {
    'FRAMEWORK_SEARCH_PATHS' => '$(inherited)'
  }
 


  spec.default_subspec = 'Debug'

  spec.subspec 'Debug' do |sp|
    sp.vendored_frameworks = 'RandomCars.xcframework' 
  end

  spec.subspec 'Release' do |sp|
    sp.vendored_frameworks =  'RandomCars.xcframework' 
  end

  spec.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 i386' }
  spec.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 i386' }


end

Step 7: Now make a commit and push the code and try to make a release and tag with your framework version . ex: 0.1

you can create a tag from command and github web both.

create tag and release tag from terminal

git tag '0.1'            

git push --tags  

Step 8: from github_repo directory run command :

test lib

arch -x86_64 pod lib lint --verbose --allow-warnings   

test spec

arch -x86_64 pod spec lint --verbose --allow-warnings  

push the code to cocoapod now

arch -x86_64 pod trunk push RandomCars.podspec --allow-warnings 

you may need to register

pod trunk register mti.tareq3@gmail.com Tareq   

After deploy it will take around 24 hours to be public meanwhile you can use git repo

 pod 'RandomCars', :git => 'https://github.com/tareq3/RandomCarsFramework.git',  :tag => '0.2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment