preface

I have been doing development for nearly five years, basically doing the business logic of the company. During this time, I also collected some useful methods during the development process. Put them all on a wheel that I wrote about earlier. ZPCategory used to just write the wheels on your Github and download them when you needed them and drag them into the projects you needed. I’m starting to see that this is a bit of a problem. I’m going to publish my own library, and basically every project I’ve ever worked on uses Cocoapods anyway. This can be done once and for all.

start

This is also my first time to do this thing, I went online to find a lot of articles. Link: 1. IOS – How to upload your own dynamic libraries to CocoaPods 2. IOS development – How to import your own libraries through POD (detailed steps) 3

Since I usually put the wheel on my Own GitHub, I’m going to post it directly to GitHub. If it’s your own company’s project, you can post it to your own Git address, just add the source address to your Podfile.

Ready to account

Create your own account on GitHub and follow the same steps as normal account applications. There will be an email verification process after registration, just click on the email link.

Create a warehouse

After creating just successful, is to add a warehouse under their own account.

Click on the picture button to create your own warehouse.



This is what you need to know about creating a library, and it’s pretty clear on the images, so let’s discuss the rest in the comments below.

Upload code

You just upload your source code, you can use terminal command line operation, you can also use visualization software

The operation is similar to Tower and SourceTree.

Registering a Trunk Account

To be honest, I’m not quite sure what it does, but I think I need it all. At the same time, you should also pay attention to the version of your POD, as this trunk is required by the POD version. It’s greater than 0.33. If it’s below 0.33, upgrade. If that’s ok then do the following

pod trunk registerYour own email address'Your own username' --description='imac' --verbose
Copy the code

Here I write is my GitHub, if you are your own Git just fill in the corresponding bar. Then check to see if you are registered successfully

pod trunk me 
Copy the code

If the following content appears, so long congratulations to you, successful, can proceed to the next step!This picture is borrowed from others, because I didn’t leave my own when I operated yesterday.

Configure the PodSpec file

1. Add the PodSpec file first, we open the terminal, CD to our project directory, and execute

Pod Spec Create Project nameCopy the code

Once successful, a. Podspec file will be added to your project directory

2. Modify file configuration There are a lot of property configuration, there are many online tutorials, that is, the three articles I mentioned at the beginning of this article are also explained. I’m not going to go into too much detail here.

3. Verify that the podSpec file is correct. There are many problems encountered in this step, and the terminal will list them for you. You just have to correct them according to their misdescriptions. Because everyone’s problems can’t be the same. Here is also a link to the article, which is the error encountered in this process, if there is something you can do, you can save trouble, if not, you need to do it yourself. (Link to the article)

4. If you pass the above verification, this time you go to your smart tag on the line. There are many ways, you can terminal, you can also go to Github on their own to play.

5. Push podSpec files through trunk

Pod Trunk Push your project.podSpecCopy the code

This can be time-consuming. But if the following words appear

Then it proves a success.

Search your own library

If you complete all the above steps, then we can search for your library.

Pod Search Your library nameCopy the code