Cocoapods工具03 -- 创建pod库

2021-08-24  本文已影响0人  YanZi_33

Cocoapods的本地文件目录

Snip20210822_179.png
origin  https://github.com/CocoaPods/Specs.git (fetch)
origin  https://github.com/CocoaPods/Specs.git (push)
Snip20210822_183.png
{
  "name": "CAIStatusBar",
  "version": "0.0.1",
  "summary": "A simple indicator",
  "homepage": "https://github.com/apple5566/CAIStatusBar.git",
  "license": "MIT",
  "authors": {
    "apple5566": "zaijiank110@sohu.com"
  },
  "platforms": {
    "ios": "6.0"
  },
  "source": {
    "git": "https://github.com/apple5566/CAIStatusBar.git",
    "tag": "0.0.1"
  },
  "source_files": "CAIStatusBar/**/*.{h,m}",
  "resources": "CAIStatusBar/CAIStatusBar.bundle",
  "requires_arc": true
}

如何创建与编写podspec文件

创建自己的pod私有库

Snip20210823_193.png Snip20210823_194.png Snip20210823_195.png Snip20210823_197.png Snip20210823_198.png Snip20210823_199.png Snip20210823_200.png Snip20210823_201.png Snip20210823_202.png Snip20210823_203.png
#
# Be sure to run `pod lib lint YYArrayLib.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = 'YYArrayLib'
  s.version          = '0.1.0'
  s.summary          = 'iOS about array lib'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  s.description      = <<-DESC
iOS OC array lib of liyanyan
                       DESC

  s.homepage         = 'https://github.com/Liyanyan33/YYArrayLib.git'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { '19053601' => '1143386318@qq.com' }
  s.source           = { :git => 'https://github.com/Liyanyan33/YYArrayLib.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '9.0'

  s.source_files = 'YYArrayLib/Classes/**/*'
  
  # s.resource_bundles = {
  #   'YYArrayLib' => ['YYArrayLib/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end
Snip20210823_204.png Snip20210823_206.png Snip20210823_207.png Snip20210823_208.png Snip20210823_209.png Snip20210823_210.png Snip20210823_212.png Snip20210823_213.png Snip20210823_214.png Snip20210823_215.png
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

source 'https://github.com/Liyanyan33/YYPrivateSpecRepo.git'

target 'Test_ArrayLib' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for Test_ArrayLib

  pod 'YYArrayLib'

end
Snip20210823_216.png Snip20210823_218.png Snip20210824_220.png
#
# Be sure to run `pod lib lint YYArrayLib.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = 'YYArrayLib'
  s.version          = '0.1.1'
  s.summary          = 'iOS about array lib'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  s.description      = <<-DESC
iOS OC array lib of liyanyan
                       DESC

  s.homepage         = 'https://github.com/Liyanyan33/YYArrayLib.git'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { '19053601' => '1143386318@qq.com' }
  s.source           = { :git => 'https://github.com/Liyanyan33/YYArrayLib.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '9.0'

  s.source_files = 'YYArrayLib/Classes/**/*'
  
  # s.resource_bundles = {
  #   'YYArrayLib' => ['YYArrayLib/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end
Snip20210824_223.png Snip20210824_222.png Snip20210824_221.png Snip20210824_219.png

创建自己的pod公有库

Snip20210824_224.png
#
# Be sure to run `pod lib lint YYNSStringLib.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  s.name             = 'YYNSStringLib'
  s.version          = '0.1.0'
  s.summary          = 'YYNSStringLib of NSString'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!

  s.description      = <<-DESC
YYNSStringLib is about OC NSString add extra extesion
                       DESC
                       
  s.homepage         = 'https://github.com/Liyanyan33/iOS-OC-Public-YYNSStringLib.git'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.author           = { 'liyanyan33' => '1143386318@qq.com' }
  s.source           = { :git => 'https://github.com/Liyanyan33/iOS-OC-Public-YYNSStringLib.git', :tag => s.version.to_s }
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'

  s.ios.deployment_target = '9.0'

  s.source_files = 'YYNSStringLib/Classes/**/*'
  
  # s.resource_bundles = {
  #   'YYNSStringLib' => ['YYNSStringLib/Assets/*.png']
  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.frameworks = 'UIKit', 'MapKit'
  # s.dependency 'AFNetworking', '~> 2.3'
end
Snip20210824_226.png Snip20210824_228.png
# 切换到CocoaPods目录
cd ~/Library/Caches/CocoaPods/
# 查看该目录下有Pods和search_index.json两个文件
ls

# 删除缓存文件
rm search_index.json

# 重新搜索
pod search YYNSStringLib
Snip20210824_230.png

pod的常见命令

Snip20210824_231.png
参考文章

https://leomobiledeveloper.blog.csdn.net/article/details/85226147

上一篇 下一篇

猜你喜欢

热点阅读