CocoaPods
是Swift
和Objective-C
Cocoa
项目的依赖管理器。类似 PHP
的 composer
, Java
的 Maven
$ brew install cocoapods
或者
$ sudo gem install cocoapods
https://mirrors.tuna.tsinghua.edu.cn/help/CocoaPods/
cd ~/.cocoapods/repos
#可能不需要移除
pod repo remove master
#很慢,最终master目录3.2G
pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
在项目根目录创建文件Podfile
,类似
vi Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'ui-tableView' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for ui-tableView
pod "Masonry"
pod "MJExtension"
end
target '2ui-tableViewDelegate' do
use_frameworks!
pod "MJExtension"
end
然后执行pod install
,不出意外会创建一个项目名.xcworkspace
文件,用Xcode
打开即可