In the process of componentization implementation, we usually use the framework to integrate various modules, but this way of integration is very inconvenient and inefficient. Therefore, using Cocopods to manage the build will be much more convenient, easy to integrate and maintain.Copy the code

Create a private library

Create command:

pod lib create x xxx

2. Answer the questions below

If you select one with demo, the demo project will be automatically opened upon completion

3. The relevant code is written here

4. Edit the PodSpec file

Mainly fill in the description, certificate, constituent address

5. Add dependencies

There are three main types:

Build your own folder, import other people’s code blocks, import the SDK

6. Verify the PodSpec file

pod lib lint –private

7. Demo debugging

Pod install –no-repo-update or pod install

After creating the private library is not finished, in our actual development process, componentization will extract a lot of public components, such as: network request, tool class, base class, routing and other components, these components need to be referenced in each module class, so we also need to create the index library of the private library.Copy the code

8. Push to the remote warehouse

Create a private library index

An index library is a place where spec files are stored for indexing to code locationsCopy the code

1. Add the index library to the local directory

Home View a list of local index libraries

pod repo list

Normal has 2 repo: cocoapods -type: git (remotes/origin/master) - URL: https://github.com/CocoaPods/Specs.git - Path: /Users/bhj/.cocoapods/repos/cocoapods trunk - Type: CDN - URL: https://cdn.cocoapods.org/ - Path: /Users/bhj/.cocoapods/repos/trunkCopy the code

Pod repo add Index library name Git address

Such as:

Pod repo add HJRepo github.com/developerBH…

Cocoapods-type: git (remotes/origin/master) -url: https://github.com/CocoaPods/Specs.git - Path: /Users/bhj/.cocoapods/repos/cocoapods HJRepo - Type: git (main) - URL: https://github.com/developerBHJ/HJRepo.git - Path: /Users/bhj/.cocoapods/repos/HJRepo trunk - Type: CDN - URL: https://cdn.cocoapods.org/ - Path: /Users/bhj/.cocoapods/repos/trunkCopy the code

2. Add the podSpec file from the private library to the REPo

pod repo push HJRepo HJTextView.podspec –allow-warnings

3. Once the association is established, we are successful

To use it, you need to add the source to your project

The source ‘gitea.xxxx.com: XXXX XXXX/HJSpec… ‘

The source ‘github.com/CocoaPods/S… ‘

At this point, you're done.Copy the code

! TheHJTextView.podspecSpecification does not validate the problem is resolved