How to share your awesome iOS code with cocoapod

Source: Internet
Author: User

To keep the reader at a glance, start with the new project to the final submission of the Podspec, a simple rough talk.
Cocoapods don't have to explain too much, a word ... It is currently the most widely used third-party library dependency Management tool in iOS development.

Let's start with the process of creating pods:

First step: Create a project
Create a new project using the Pod lib create command

Pod Lib Create mylib
During the execution of this command, ask the east to ask for a new project, and your code can be put inside.
Note: The last step of this command executes the pod install, and if it is too slow or by the wall, you can break it off and execute it yourself

Pod Install--verbose--no-repo-update
Step Two: Write the Podspec file
Look at your project there is a mylib.podspec file, modify it, and then execute


Pod Lib Lint Mylib.podspec
This command check your podspec is not a problem, if there is no problem will prompt passed validation, there is a problem will point out.

Step Three: Engage your code
Please forgive me for the word ' engage ' ... is to get the code you want to manage or share to get into this project, write a example, and make him run without problems.

Fourth step: Play tag and verify Podspec
Hit tag and push

git tag 1.0.0
Git push Origin 1.0.1

After you push the tag, you need to verify the Podspec again, note that your tag version number should be the same as Podspec.
Pod Spec Lint Mylib.podspec

Fifth step: Push to spec Repository
Verification is not a problem, you can push, but wait ... If you are pushing for the first time, create a session first:
Pod Trunk Register[email protected]' Your Name '--description= ' MacBook Air '

Then check the email to confirm the email is OK. Here's the push:
Pod Trunk Push Mylib.podspec

With this step, you're done. Finally you update the pod and then your code will be able to search for it on the pod.
Pod Search Mylib

In the end, you can ask someone else to use your pod:
Pod ' mylib ', ' ~>1.0 '

Sixth step: Fq problem
Cocoapods Spec If you want to update, often will be the wall, you can execute the following command, the address to the domestic mirror can:


Pod Repo Remove Master
Pod Repo Add Master Https://gitcafe.com/akuandev/Specs.git
OrHttp://git.oschina.net/akuandev/Specs.git
Pod Repo update


Concluding remarks:
In the future if you want to update the pod version, it is also very simple, basically playing tag+push, that is, repeating the 4th and 5th steps mentioned above.

How to share your awesome iOS code with cocoapod (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.