Summary of the iOS Homemade Framework
Once the Framework is finished, let’s talk about how to upload to Cocoapods for everyone to use.
1. Create a repository
Create your own repository on GitHub, fill in the information, select the configuration, and click the Create Repository button to create a repository. If you select a License file, there are two default README and License files in the repository.
2. Clone the repository to the local PC, open the terminal, and run the following command:
Command: # git clone cloned to the local warehouse, such as the directory parameter is null, the clone to the current directory exm: git clone https://github.com/dxsGitHub/ListEmptyDataStyle.gitCopy the code
Create a PodSpec file and configure it
1. Run the following commands, in the folder will generate a ListEmptyDataStyle podspec file
pod spec create ListEmptyDataStyle
Copy the code
2. When opened in Xcode, there are many default configurations, which will look like this after customization
Pod: : Spec. New do | Spec | Spec. The name = "ListEmptyDataStyle" Spec. Version = "1.0.3" Spec. The summary = "ListEmptyDataStyle Set the UITableView, UICollectionView numerous placeholder view style according to the time. "the spec. The homepage = 'https://github.com/dxsGitHub/ListEmptyDataStyle' spec.license = { :type => "MIT", :file => "LICENSE" } spec.author = { "dxs" => "[email protected]" } spec.platform = :ios, "13.0" spec. Ios. Deployment_target = "13.0" spec. Source = {: git = > 'git://github.com/dxsGitHub/ListEmptyDataStyle.git', Resources = "ListEmptyStyle/*.{bundle}" spec.source_files = "ListEmptyStyle/*.{h,m}" spec.requires_arc = true endCopy the code
4. Add functional codes and resource files to the local repository, and then submit and push to the remote end. The command is as follows:
Git tag -a v1.0.0 -m "v1.0.0" -m "v1.0.0" -m "v1.0.0" -m "v1.0.0" # TagCopy the code
5. The terminal runs command + verify information + verify the PodSpec file
1. Run the command to register the Trunk. After receiving an email, click the link in the email to activate it
Pod Trunk register EMAIL [YOUR_NAME] #Copy the code
2. Run the command to view the information
pod trunk me
Copy the code
3. Run commands to verify the Podspec file
pod lib lint ListEmptyDataStyle.podspec --use-libraries --allow-warnings --sources='https://github.com/CocoaPods/Specs.git'
Copy the code
4. The green prompt indicates that the verification is successful. If there are any errors, correct them one by one according to the prompt.
Upload the PodSpec file to cocoapods
pod trunk push --allow-warnings
Copy the code
7. Confirm pod Setup and POD Search
After uploading successfully, you can run pod Setup and POD Search to query your own library. This is normal, you can write a podfile in the Demo to try!
8, climb pit summary
Step 6: You must first Release the podSpec version to your GitHub repository. If you don’t Release the podSpec version, you may not find it!