インストール
$ sudo gem install cocoapods
セットアップ
$ pod setup
Setting up CocoaPods master repo
Setup completed
$ pod --version
0.39.0
コマンドはこんな感じ
$ pod --help
Usage:
$ pod COMMAND
CocoaPods, the Cocoa library package manager.
Commands:
+ cache Manipulate the CocoaPods cache
+ init Generate a Podfile for the current directory.
+ install Install project dependencies to Podfile.lock versions
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ plugins Show available CocoaPods plugins
+ repo Manage spec-repositories
+ search Search for pods.
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)
+ try Try a Pod!
+ update Update outdated project dependencies and create new Podfile.lock
Options:
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
作業ディレクトリに移動しinitコマンドを打つと、Podfileが生成される
$ cd (pj directory)
$ pod init
Podfileにインストールしたいパッケージを追記
$ cat Podfile
# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
# use_frameworks!
target 'todoSample' do
pod 'MagicalRecord' #追記
end
target 'todoSampleTests' do
end
target 'todoSampleUITests' do
end
インストールすると、Podfile.lock、Podsディレクトリ、(pj名).xcworkspaceディレクトリが生成される
$ pod install
XCodeから(pj名).xcworkspaceディレクトリをopenしてからXCodeを開きなおすと、XCode上に表示される