到本地目录下:
bogon:component mr.zhang$ cd YSTHome/
创建本地spec:
bogon:YSTHome mr.zhang$ pod lib create YSTHome
回答问题:
To get you started we need to ask a few questions, this should only take a minute.
If this is your first time we recommend running through with the guide:
- https://guides.cocoapods.org/making/using-pod-lib-create.html
( hold cmd and double click links to open in a browser. )
What platform do you want to use?? [ iOS / macOS ]
> ios
What language do you want to use?? [ Swift / ObjC ]
> objc
Would you like to include a demo application with your library? [ Yes / No ]
> yes
Which testing frameworks will you use? [ Specta / Kiwi / None ]
> none
Would you like to do view based testing? [ Yes / No ]
> yes
What is your class prefix?
> YST
成功标志:
Analyzing dependencies
Fetching podspec for `YSTHome` from `../`
Downloading dependencies
Installing FBSnapshotTestCase (2.1.4)
Installing YSTHome (0.1.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `YSTHome.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There are 2 dependencies from the Podfile and 2 total pods installed.
开始编辑spec文件: (ps: 这个是初始什么都木有改过的 s.source Git地址如果是生成本地的不需要填写,如果需要传到Git则否)
Pod::Spec.new do |s|
s.name = 'YSTHome'
s.version = '0.1.0'
s.summary = 'A short description of YSTHome.'
s.description = <<-DESC
TODO: Add long description of the pod here.
DESC
s.homepage = 'https://github.com/张xx/YSTHome'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { '张xx' => 'zhangxx@xxx.com' }
s.source = { :git => '', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.source_files = 'YSTHome/Classes/**/*'
这个是修改过路径的: (这里需要说一哈 生成的项目中有放置图片的地址的,但是我没那么做,个人习惯用buddle^_^)
s.source = { :git => "", :tag => "0.0.1" }
s.source_files = "YSTHome", "YSTHome/**/*.{h,m}"
s.exclude_files = "YSTHome/Exclude"
s.public_header_files = "YSTHome/**/*.h"
s.resource = "YSTHome/**/*.{bundle,json}"
s.vendored_frameworks = "YSTHome/**/*.{framework,a}"
然后就是把开始撸码~
开始验证:
bogon:~ mr.zhang$ cd /Users/mr.zhang/Desktop/8.0keper/component/YSTHome/YSTHome
bogon:YSTHome mr.zhang$ pod lib lint YSTHome.podspec --allow-warnings
-> YSTHome (0.1.0)
- WARN | summary: The summary is not meaningful.
- WARN | url: There was a problem validating the URL https://github.com/张xx/YSTHome.
YSTHome passed validation.
主工程导入:
pod 'YSTHome', :path => './component/YSTHome/'