IOS componentization of the production of private libraries

1. Create a project library and open terminal input

pod lib create xxx

1.1 After entering relevant information, Xcode will automatically open the project.

1.2 Finding the Configuration File

xxx.podspec

1.3 Open the configuration file and configure it as required

S.sion = ‘0.0.1’ # version number, which needs to be the same as the tag sent to the remote end

Epage = ‘github.com/xxx/xxx’ # the homepage of the github library where you are located

S.source_files = ‘XXX /**/*’ # Source file path

S.frameworks = ‘UIKit’, “# dependency on system libraries

S.dependency = “, “# Dependency on third party libraries

1.4 After the configuration is complete, open the project file. Pull the code files we need to upload into XXX -> XXX -> Classes

1.5 Then CD into the Example file pod Install to install our component

1.6 Uploading the local Library to Github

B. Git remote add origin [email protected]:x/xxx.git # establish contact with remote repository c. git add E. git push -u origin master -f # git tag 0.0.1 # The tag must match the podSpec file versionCopy the code

Create a private Github index library for Cocoapods import

A. pod repo add private component name Index library remote address Execution of the local library folder will be XXX Cocoapods index (/ Users/XXX /. Cocoapods/repos) b. Podspec --allow-warnings Pod repo push XXX XXX. Podspec --allow-warnings adds a version 0.0.1 to the indexCopy the code

1.8 cocoapods use

# note that adding the source address is the index pofile 'https://github.com/xxx/xxx.git' pod installCopy the code