前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >【iOS】将代码上传到pod创库

【iOS】将代码上传到pod创库

作者头像
MapleYe
发布2020-03-30 17:10:25
7580
发布2020-03-30 17:10:25
举报
文章被收录于专栏:MapleYeMapleYe

1、利用pod创建项目

代码语言:javascript
复制
pod lib create PPKit

这时候的生成工程目录为

目录
目录

编写podspec文件

代码语言:javascript
复制
#
# Be sure to run `pod lib lint PPKit.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             = 'PPKit'
  s.version          = '0.0.1'
  s.summary          = 'A short description of PPKit.'

# 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
TODO: Add long description of the pod here.
                       DESC

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

  s.ios.deployment_target = '8.0'

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

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

可以看到我们指定source_files指定在PPKit/Classes文件夹下的所有文件,所以我们的源码都放在这里就可以了

2、上传代码到pod

podspec文件编辑好后,我们就可以上传该文件到pod上了,进入podspec同级目

代码语言:javascript
复制
pod trunk push

如果之前没有注册pod账号的,先注册/登录也是执行以下指令

代码语言:javascript
复制
pod trunk register 305554601@qq.com 'maple'

3、私有库

私有库跟公有库最大的区别就是,podspec的文件摆放位置。如果podspec文件都上传到github上的 https://github.com/CocoaPods/Specs,所以如果我们想搭建私有库,我们也要在自己的仓库搭建一个专门存放specs文件的地方。那么我们上传spec文件的时候,就要添加仓库和推送指定的仓库

代码语言:javascript
复制
// 添加
pod repo repoName git@git.xxx.xxx:iOSPods
// 推送
pod repo push repoName xxx.podspec

更详细的内容可以参考 http://www.cocoachina.com/articles/26210

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1、利用pod创建项目
  • 2、上传代码到pod
  • 3、私有库
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档