随着对 CocoaPods 越来越多的依赖,我们也可以尝试把自己的库发布到它上面。

1.在Github上新建一个项目(名字我随便取了一个,其他步骤截图为WCUIKit)。自己做相应修改即可。

2.克隆到本地  git clone https://github.com/dianziguan1234/WCUIKit.git

Xcode创建项目。添加自己的代码。目录结构大致为

其中SourceCode存放源码部分,就是后来通过cocoapods安装以后得到的代码块。

WCUIKit存放我们Xcode创建的项目。

3.重要的一步。添加tag并提交github master分支。

git add -A && git commit -m "Release 1.0.2"
git tag '1.0.2'
git push --tags
git push origin master

4:创建podspec文件。

cd WCUIKit
pod spec create WCUIKit.podspec

之后在该目录下会生成一个 WCUIKit.podspec 文件,该文件是 Ruby 编写的,打开并编辑这个文件,填写好配置文件。

#
# Be sure to run `pod spec lint WCUIKit.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
# Pod::Spec.new do |s| # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
# s.name = "WCUIKit"
s.version = "1.0.2"
s.summary = "任意视图添加角标" # 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.homepage = "https://github.com/dianziguan1234/WCUIKit"
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Licensing your code is important. See http://choosealicense.com for more info.
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
# #s.license = "MIT (example)"
s.license = { :type => "MIT", :file => "FILE_LICENSE" } # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the authors of the library, with email addresses. Email addresses
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# accepts just a name if you'd rather not provide an email address.
#
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
# s.author = { "guanweicheng" => "1396539283@qq.com" }
# Or just: s.author = "guanweicheng"
# s.authors = { "guanweicheng" => "1396539283@qq.com" }
# s.social_media_url = "http://twitter.com/guanweicheng" # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target. You can optionally include the target after the platform.
# s.platform = :ios
s.platform = :ios, "8.0" # When using multiple platforms
# s.ios.deployment_target = "5.0"
# s.osx.deployment_target = "10.7"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0" # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
# Supports git, hg, bzr, svn and HTTP.
# s.source = { :git => "https://github.com/dianziguan1234/WCUIKit.git", :tag => "#{s.version}" } # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
# s.source_files = 'SourceCode/**/*.{h,m}'
#s.exclude_files = "SourceCode/" s.public_header_files = "SourceCode/**/*.h" # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. Anything else will be cleaned.
# You can preserve files from being cleaned, please don't preserve
# non-essential files like tests, examples and documentation.
# # s.resource = "icon.png"
# s.resources = "Resources/*.png" # s.preserve_paths = "FilesToSave", "MoreFilesToSave" # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
# # s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework" # s.library = "iconv"
# s.libraries = "iconv", "xml2" # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If your library depends on compiler flags you can set them in the xcconfig hash
# where they will only apply to your library. If you depend on other Podspecs
# you can include multiple dependencies to ensure it works. s.requires_arc = true # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# s.dependency "JSONKit", "~> 1.4" end

红色部分稍微留意下。如果需要详细文档请移步 Specs and the Specs Repo

5.验证podspec文件

cd WCUIKit
pod spec lint WCUIKit.podspec

6.注册上传到cocoapods

pod trunk register 1396539283@qq.com 'guanweicheng' --description='gwc'

pod trunk push WCUIKit.podspec

如果不出意外的话。会恭喜你发布成功。

7.然后可以pod search 你自己的库文件了。这里可能会出搜索不到的情况。参考链接解决即可(原理简单)。http://blog.cocoachina.com/article/29127

podspec文件可以参考我的项目。https://github.com/dianziguan1234/WCUIKit.git

制作并发布个人CocoaPods库的更多相关文章

  1. Xamarin:制作并发布apk

    原文:Xamarin:制作并发布apk 终于到了激动人心的时刻:要向真机发布apk了.流程如下: 1 制作release版的android应用安装包apk文件: 1.1 用VS2012中文版制作:记得 ...

  2. 制作pypi上的安装库

    下载地址 如何制作分发工具呢 setuppy 源码包 其他文件 制作过程 首先上场的肯定是setuppy了如下 然后是LICENCE 注册 测试 总结 自从接触Python以来也有几个月了,虽然主要的 ...

  3. 手把手图文并茂教你发布Android开源库

    转载请把头部出处链接和尾部二维码一起转载,本文出自逆流的鱼,文章链接: http://blog.csdn.net/hejjunlin/article/details/52452220 经常逛githu ...

  4. 教你一步步发布一个开源库到 JCenter

    今天想来分享下,如何一步步自己发布一个开源库到 JCenter 这方面的博客网上已经特别多了,所以本篇并不打算仅仅只是记录流程步骤而已,而是尽可能讲清楚,为什么需要有这个步骤,让大伙知其然的同时还知其 ...

  5. Egret第三方库的制作和使用(模块化 第三方库)

    一.第三方库的制作 官方教程:第三方库的使用方法 水友帖子:新版本第三方库制作细节5.1.x 首先在任意需要创建第三方库的地方,右键,选择"在此处打开命令窗口" 输入egret c ...

  6. 【我的Android进阶之旅】快速创建和根据不同的版本类型(Dev、Beta、Release)发布Android 开发库到Maven私服

    前言 由于项目越来越多,有很多公共的代码都可以抽取出一个开发库出来传到公司搭建好的Maven私服,以供大家使用. 之前搭建的Maven仓库只有Release和Snapshot两个仓库,最近由于开发库有 ...

  7. 发布Android开源库,看这个文章就够了!

    最近在Flipboard实习期间写了一个轮播工具,技术上没什么难点,不过动画效果还是不错的,决定改改代码写个库开源出去.项目地址:http://github.com/chengdazhi/Decent ...

  8. Docker系列-(2) 镜像制作与发布

    上篇文章引入了Docker的基本原理和操作,本节文章主要介绍如何制作Docker镜像和发布. 镜像文件结构 Docker镜像的本质是一系列文件的集合,这些文件依次叠加,形成了最后的镜像文件,类似于下图 ...

  9. 使用Jitpack发布开源Java库

    原文:使用Jitpack发布开源Java库 | Stars-One的杂货小窝 很久之前也写过一篇使用Jitpack发布Android开源库的文章,详见Android开发--发布第三方库到JitPack ...

随机推荐

  1. poj 1986tarjan模板题

    #include<iostream> #include<vector> using namespace std; const int N=40010; int pre[N];/ ...

  2. Intent使用Parcelable传递对象

    package com.pingyijinren.test; import android.os.Parcel; import android.os.Parcelable; import java.i ...

  3. React Native学习(十)—— 生命周期

    本文基于React Native 0.52 Demo上传到Git了,有需要可以看看,写了新内容会上传的.Git地址 https://github.com/gingerJY/React-Native-D ...

  4. Mybatis 最强大的动态sql <where>标签

    <select id="findActiveBlogLike" resultType="Blog"> SELECT * FROM BLOG WHER ...

  5. Map根据value排序ASC DESC

    原文:http://blog.csdn.net/k21325/article/details/53259180 需求有点刁钻,写关键词组合匹配标题的时候,遇到关键词像这样 XXX XXX 1222 X ...

  6. python比较大小

    1.python的比较总是检查复合对象的所有部分,直到可以得出结果为止. 2.会自动遍历嵌套的所有数据结构,有多深走多深,首次发现的差值将决定比较的结果 3.== :操作符测试值的相等性 4.is : ...

  7. UIButton和UISlider

    UIButton 主要功能:按钮控件,主要用于与用户操作进行交互 经常使用属性及方法 系统内建的按钮类型 UIButtonTypeCustom UIButtonTypeSystem UIButtonT ...

  8. C# 复制和克隆认识浅谈

    如有雷同,不胜荣欣.若转载,请注明 在C#中,用HashTable,DataTable等复制和克隆浅谈,以下直接看样例 HashTable ht = null; ht = new HashTable( ...

  9. mysql查看所有存储过程,函数,视图,触发器,表

    查询数据库中的存储过程和函数 方法一: select `name` from mysql.proc where db = 'your_db_name' and `type` = 'PROCEDURE' ...

  10. 在js中取选中的radio值

    在js中取选中的radio值 <input type="radio" name="address" value="0" /> & ...