Here are a few points to start with:

Add a private specs.git file and add your own third-party library updates to it.

Use the POD repo file to view the existing index library.

1. Add remote index Specs libraries

Create your own remote private repository XXXSpecRepo on Git and add this remote private repository locally:

pod repo add XXXSpecRepo https://git.xxx/xxxx/XXXSpecRepo.git

Look in the Finder directory ~/.cocoapods/repos to see that a XXXSpecRepo repository has been added.

/ / picture

Create git third-party library (public)

Create a public project on GitHub that must contain these files:

  1. LICENSE: Open source LICENSE;
  2. Readme. md: Warehouse description;
  3. Your code;
  4. Mypoject. podSpec: the description file of CocoaPods. This file is very important;

The focus is on creating. Podspec files

Podspec is a Ruby configuration file that describes information about your project, in the root directory

pod spec create MyPoject

Then create a success, open can press the above modification, fill in the corresponding information; You can query the specific field meanings on the Internet.

Next, verify that the important.podspec file is formatted correctly,

Pod lib Lint (--allow-warnings) // Verify local

Pod Spec Lint // Validate remote

3, tag (same as public library)

Submit the code to remote with a tag that matches the podSpec number. The tag is a compressed package of your repository for stable storage of the current version;

$ git tag -a 1.0.0 -m 'Label Description' 
$ git push origin --tags
Copy the code

PodSpec

In the root directory:

pod repo push XXXSpecRepo MyPoject.podspec

Will to authenticate the remote warehouse at this moment, success will be in ~ /. Cocoapods/repos/XXXSpecRepo description information found in the new warehouse

/ / picture

If there is an error message

[!] The repo is not clean

Update our version library and continue to upload.

pod repo update XXXSpecRepo

Pod Repo push XXXSpecRepo myPoject. podspec

Verify that the mypoject. podSpec file pulls from the remote repository XXXSpecRepo add myPoject. podSpec to the repository push to remote

Here is how the private library submitted successfully

Note Pod Search is available after the release is successful. If search fails, you can update the cache:

rm ~/Library/Caches/CocoaPods/search_index.json

5. Use integration

To use a private pod library, add this phrase to your Podflie to specify the address of your index library. If a public POD library is used, you need to bring the public library address with you.

source'https://git.xxx/xxxx/XXXSpecRepo.git'source'https://github.com/CocoaPods/Specs.git'Copy the code

Finally, pod install is used

6. Update and maintenance

When your code is updated and maintained, it needs to be rewritten and distributed. The process is as follows:

  1. Update the version number in myPoject. podSpec
  2. Label it and push it remotely
  3. Pod Trunk pushes myPoject. podSpec to the Pods repository

Look at this for now, and I’ll come back to iOS development: CocoaPods Remote private repository maintenance updates