LoginSignup
10
9

More than 5 years have passed since last update.

CocoaPods で template file を使う

Last updated at Posted at 2013-12-17

プロジェクト開始時 前回のプロジェクトから Podfile をコピーして使う場合があると思います. しかし, ~/.cocoapods/template にテンプレートファイルをおいておくことで pod init する際にこのテンプレートをもとに Podfileを作成してくれます.

手順

1. 以下の場所にPodfile.default と Podfile.test を用意します.

$ pwd
/Users/u16suzu/.cocoapods/templates

$ ls
Podfile.default Podfile.test

Podfile.default

platform :ios, '6.0'
pod 'AFNetworking'
pod 'UAModalPanel'
pod 'MBProgressHUD'
pod 'BlocksKit'
pod 'Underscore.m'
pod 'MagicalRecord'

Podfile.test

pod 'Kiwi'
pod 'KIF', '~> 2.0'

2. コマンドを実行します.

$ pod init

3. 以下のような Podfile が生成されます.

# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"

target "podTemplateSpike" do
  platform :ios, '6.0'

  pod 'AFNetworking'

  pod 'UAModalPanel'

  pod 'MBProgressHUD'

  pod 'BlocksKit'

  pod 'Underscore.m'

  pod 'MagicalRecord'
end

target "podTemplateSpikeTests" do
  pod 'Kiwi'

  pod 'KIF', '~> 2.0'
end

注意点

~/ にPodfile があると pod init に失敗しますのでご注意ください.

$ pod init
[in /Users/u16suzu]
[!] Existing Podfile found in directory
10
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9