Helpful links to get started:
- http://guides.cocoapods.org/using/getting-started.html
- http://www.raywenderlich.com/12139/introduction-to-cocoapods
- http://theonlylars.com/blog/2013/01/20/cocoapods-creating-a-pod-spec/
- Install Xcode or command line tools (
xcode-select --install
) sudo gem install cocoapods
(if needed:sudo gem update --system
)- Create new Xcode project
touch Podfile
&&open -e Podfile
pod install
Sample Podfile
platform :ios, '7.0'
pod 'AFNetworking'
Resulting directory layout:
- Project/
- Project/
- *.{h,m}
- Project.xcodeproj
- Project.xcworkspace
- Podfile
- Pods/
- Pods.xcodeproj
Discussion:
- Xcode workspace, projects, Build Phases, Info settings
- Podfile.lock, Pods directory
- Check in Pods directory
pod outdated
,pod update
- Alternative directory layout using
xcodeproj
- Version selector:
<, >, =, ~>
, e.g.AFNetworking ~> 1.3
- Head:
pod 'AFNetworking', :head
- Fork or specific version:
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af'
- git submodules vs Cocoapods
pod 'AFNetworking', :path => '~/Documents/AFNetworking'
- Binary pods
- Version numbers: 3.0.3a
- Test target only pod -> https://github.com/optionu/stolpersteine-ios/blob/master/Podfile
- Reveal -> no configuration based pod
- Version Eye
- Private pods: http://guides.cocoapods.org/making/private-cocoapods.html
pod spec create AlertViewController
or copy from existing podspecopen -e AlertViewController.podspec
- Add
pod 'AlertViewController', :path => '..'
to your project for testing - When done testing, tag source code with version
pod spec lint
- Fork Specs repo
- Add your podspec and create pull request
Sample podspec
Pod::Spec.new do |s|
s.name = 'AlertViewController'
s.version = '0.0.1'
s.license = 'MIT'
s.summary = 'Cocoapods workshop excercise.'
s.homepage = 'https://github.com/choefele/cocapods-workshop'
s.authors = { 'Claus Höfele' => '[email protected]' }
s.social_media_url = 'https://twitter.com/claushoefele'
s.source = { :git => 'https://github.com/choefele/cocapods-workshop.git', :tag => s.version.to_s }
s.requires_arc = true
s.ios.deployment_target = '6.0'
s.source_files = 'Pod/*.{h,m}'
end