Cocoapods create a local library

This article explains how to use the main local library cocoapods

1, create a whole file structure

  1. First, choose a location to create a folder, for example: CocoapodsProject;
  2. cd to the "CocoapodsProject" path, and then create a file library file storage folder, here named "TestLibrary";
  3. Use Xcode to create a Project, named here as "TestDemo";

After completion of the above steps, as shown below:
Here Insert Picture Description

2, create a local library

  1. Open to the lower terminal cd "TestLibrary";
  2. Create a file repository folder, here to "Classes" for example;
  3. The project requires the use of the relevant SDK, source code, resources into "Classes" folder;
  4. cd to "Classes" on a path;
  5. Create a file `` podspec```
pod spec create TestLibary   //创建podspec文件

After completion of the structure as shown below:
Here Insert Picture Description

3, modify the file podsec

  1. Modify the configuration file description
    Here Insert Picture Description
  2. Modify the source configuration

Here Insert Picture Description

  1. Modify project linking problem

Here Insert Picture Description

4, uses its own library project

  1. cd root path to the project, and then perform "pod init" command
# 切到项目根路径
cd TestDemo
# pod初始化
pod init

  1. Modify Podfile file as follows
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'TestDemo' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for TestDemo

pod 'TestLibrary', :path=>'../TestLibrary'

end

  1. In the library project to install root path
pod install
  1. FIG terminal after executing the followingHere Insert Picture Description

This allows the use of their own local library

Published 172 original articles · won praise 35 · views 390 000 +

Guess you like

Origin blog.csdn.net/u012198553/article/details/103561762