一、Podfile文件??
platform :ios,'7.0'
# 去掉來(lái)自cocoapods的所有警告
inhibit_all_warnings!
def commonPods
pod 'AFNetworking', '~> 2.5.0'
pod 'SDWebImage', '~> 3.7.1'
pod 'YYModel', '~> 1.0.4'
pod 'UEKFoundation', :git => 'https://github.com/yangyongzheng/UEKFoundation.git'
end
target 'TestApp' do
commonPods
end
target 'TestAppTests' do
inherit! :search_paths
end
二萝快、Podfile語(yǔ)法參考
Podfile Syntax Reference官網(wǎng)
1)永遠(yuǎn)使用最新版:pod 'YYModel'
2)使用固定版本:pod 'YYModel', '1.0.4'
3)操作符:
-
= 0.1
Version 0.1. -
> 0.1
Any version higher than 0.1. -
>= 0.1
Version 0.1 and any higher version. -
< 0.1
Any version lower than 0.1. -
<= 0.1
Version 0.1 and any lower version. -
~> 0.1.2
Version 0.1.2 and the versions up to 0.2, not including 0.2. This operator works based on the last component that you specify in your version requirement. The example is equal to>= 0.1.2
combined with< 0.2.0
and will always match the latest known version matching your requirements.
三、workspace多工程聯(lián)編Podfile文件編寫(xiě)
# 多工程聯(lián)編Podfile文件配置
workspace 'YZWorkSpace' # 需要生成的workspace的名稱(chēng)
# project 'path' 指定包含Pods庫(kù)應(yīng)鏈接的目標(biāo)的Xcode項(xiàng)目纹冤,其中path為項(xiàng)目鏈接的路徑
# 對(duì)于1.0之前的版本寝受,請(qǐng)使用xcodeproj
project 'YZToolsLib/YZToolsLib' # 工具庫(kù)工程
project 'YZToolsDemo/YZToolsDemo' # 實(shí)例工程
platform :ios, '7.0'
inhibit_all_warnings! # 禁止CocoaPods庫(kù)中的所有警告蝇闭。
def commonPods
pod 'FMDB'
end
# This Target can be found in a Xcode project called `ToolsSDK`
# 工具庫(kù)工程需要引入的第三方庫(kù)
target 'YZToolsLib' do
project 'YZToolsLib/YZToolsLib'
commonPods
end
# Same Podfile, multiple Xcodeprojects
# 實(shí)例工程需要引入的第三方庫(kù)
target 'YZToolsDemo' do
project 'YZToolsDemo/YZToolsDemo'
commonPods
end
項(xiàng)目目錄結(jié)構(gòu)樹(shù)如下:
注:
tree -L N
這個(gè)命令,只查看當(dāng)前第N級(jí)的目錄和文件躏将。
- 此命令需要安裝
tree
锄弱,安裝命令:brew install tree
。- 安裝
brew
命令:/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"