配置podspec文件
2019-08-12 本文已影响0人
_RG
创建spec描述文件需要后需要进行修改填写的的描述文件内容:
可以查看参考https://guides.cocoapods.org/


需要填写的内容
Pod::Spec.new do |spec|
spec.name = 'Reachability'
spec.version = '3.1.0'
spec.license = { :type => 'BSD' }
spec.homepage = 'https://github.com/tonymillion/Reachability'
spec.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
spec.summary = 'ARC and GCD Compatible Reachability Class for iOS and OS X.'
spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
spec.source_files = 'Reachability.{h,m}'
spec.framework = 'SystemConfiguration'
end
- 用Xcode打开spec文件, 需要修改的地方
1.1 summary和description, homepage 的修改

homepage的地址为项目的路径

summary和description, homepage 修改后

s.licemse 填写MIT就可以
注意注释掉原来的 S.license
s.license = "MIT"
#s.license = { :type => 'MIT', :file => 'LICENSE' }

1.3 source的修改, 修改为远程git地址

修改步骤, 找到项目的Git地址,进行source修改

1.4 s.source_files文件 (哪些文件可供下载)

一般有子目录的 需要设置成这样, 注释掉默认的
s.source_files = 'RGTestZJ/Classes/*/'
#s.source_files = 'RGTestZJ/Classes/**/*'
//sn为随意命名
s.subspec 'NSAttributedString' do |sn|
sn.source_files = 'RGTestZJ/Classes/NSAttributedString/**/*'
end
//sc为随意命名
s.subspec 'UIColor' do |sc|
sc.source_files = 'RGTestZJ/Classes/UIColor/**/*'
end

如果想买里面依赖了其他第三方库
可以使用
s.dependency 'AFNetworking', '~> 2.3'

如果只需要下载库里面的某个子库,或只需要依赖某个子库
则可以在在后面加上子库的名字
sal.dependency 'RGCategory/NSObject'