iOS 最简单的cocoapods私有库制作

    xiaoxiao2022-07-13  168

    第一步:创建Git仓库并编写代码。第二步:创建tag。第三步:在项目工程根目录下创建podspec文件   pod spec create 工程名称

    若提示没有注册执行 :

    pod trunk register '邮箱' '用户名' --description='电脑描述'

    收到邮件激活即可

    第四步:编辑podspec文件,示例如下(可直接复制):

      Pod::Spec.new do |s|   #和.podspec的名称一样   s.name         = "TagsListView"   #版本号,每一个版本对应一个tag   s.version      = "0.0.5"   #简介   s.summary      = "标签列表"   #描述   s.description  = <<-DESC                     标签列表                    DESC   #项目主页地址   s.homepage     = "https://github.com/zenganiu/TagsListView"   #许可证   s.license      = "MIT   #作者   s.author             = { "xuhuimin" => "1126981418@qq.com" }   #支持的pod最低版本   s.ios.deployment_target = "12.1"   #项目的地址,你在git上的项目地址   s.source       = { :git => "https://github.com/zenganiu/TagsListView.git", :tag => "#{s.version}" }   #需要包含的源文件   s.source_files  = "TagsListView/*.swift"   #是否ARC   s.requires_arc = true   #依赖库   #s.dependency "JSONKit", "~> 1.4"   #swift版本   s.pod_target_xcconfig = {       'SWIFT_VERSION' => '4.2'   } end

    第五步:push到git仓库

    第六步:使用,在podfile的增加需要的库;注意需要指定git仓库地址

    pod 'TagsListView',:git=>'https://github.com/zenganiu/TagsListView.git'

     

    最新回复(0)