iOS pod创建本地库

2020-03-11  本文已影响0人  YF_0630

Xcode pod 本地库

前言

如果没有cocoapods,先安装环境。

创建pod本地库

cd 到项目工程下

cd /Users/cyf/Desktop/PodTest

新项目的话没有用pod 需要init下

pod init

创建本地库存储的文件夹

用来专门存放本地库文件的名字随便起


图1

配置本地库

建立一个文件夹和库名相同


图2

创建podspec文件

cd /Users/cyf/Desktop/PodTest/PodLib/Development Pods
pod spec create Pods

Pods.podspec 文件


图3

修改podspec 文件

  1. 修改 s.summary 描述
s.summary      = "A short description of Pods."
  1. 修改 s.description 描述
# 去掉这个DESC
s.description  = <<-DESC
                   DESC
# 替换这种的
s.description  = "A short description of Pods."
  1. 去除文件里关于EXAMPLE 相关内容,s.homepage 不能为空随意填写。
s.homepage    = "123"
  1. 修改路径
    tag是版本号
# 修改
s.source = { :git => "http://EXAMPLE/Pods.git", :tag => "#{s.version}" }
# 替换为
s.source   = { :git => "", :tag => "0.0.1" }
  1. 创建LICENSE文件
    新建 LICENSE 文本文件,内容我是这样的,(随便写)我选择的MIT
MIT License

Copyright (c) 2019 cyf

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

  1. 配置LICENSE
# 配置 LICENSE
s.license      = "LICENSE"
  1. 在 /Users/cyf/Desktop/PodTest/PodLib/ 下创建源文件夹 把需要pod的文件拖拽进入


    图4
# 修改
s.source_files  = "Classes", "Classes/**/*.{h,m}"
# 配置文件
s.source_files  = "PodsLib", "PodsLib/**/*.{h,m}"

填写Podfile

pod 'Pods', :path => './PodLib/Development Pods'
图5

Pod 本地库

cd 到项目目录下

pod install
#如果本地repo库太长时间没更新可以使用下面命令 忽略更新
pod install --verbose --no-repo-update
上一篇下一篇

猜你喜欢

热点阅读