Making a CocoaPod from an existing Xcode project

前端 未结 2 489
眼角桃花
眼角桃花 2021-01-01 13:12

I\'ve been trying to crack this with no avail so far. I have my Xcode Swift project with its github repository for source control. I would like to create a new CocoaPod with

2条回答
  •  被撕碎了的回忆
    2021-01-01 14:12

    Easy steps to create Cocoapod from existing xcode project

    • Create a repository on your git account (Repo name, check README, choose MIT under license).
    • Copy the url of your repository.Open terminal and run following command.

      git clone copied your repository url

    • Now copy your Xcode project inside the cloned repository folder on your Mac. Now run following commands

      git add -u to add all files (if not added use: git add filepath/folder)

      git commit -m "your custom message"

      git push origin master

    • Create a new release to go to your git repository or run following commands

      git tag 1.0.0

      git push --tags

    • First, we need to make sure that you have CocoaPods installed and ready to use in your Terminal. run the following command:

      sudo gem install cocoapods --pre

    Creating a Podspec 

    • All Pods have a podspec file. A podspec, as its name suggests, defines the specifications of the Pod! Now let’s make one, run following command on terminal

      touch PodName.podspec

    • After adding and modifying your .podspec file. Validate your .podspec file by hitting following command on terminal

      pod lib lint

    • Once you validate it successfully without errors run following command to register you and build cocoapod respectively

      pod trunk register  

      pod trunk push PodName.podspec

    If all goes well, you will get this on terminal

提交回复
热议问题