So, you're starting a new Xcode project
- Look for some libraries to use in your project
- Maybe an OAuth ibrary?
- How to import it into your project?
Installation instructions
drag the OAuth2Client.xcodeproj into your project
add OAuth2Client as a build dependency
add OAuth2Client/** to your user header search path in the build settings
link your target against OAuth2Client (drag the OAuth2Client product from OAuth2Client.xcodeproj to your targets Link Binary With Libraries)
#import "NXOAuth2.h"
Why is manual installation problematic?
- Error-prone
- Upgrade path unclear
- No transitive dependencies
Worst of all?
The library source is supposed to be added to version control!
Other languages and platforms have automated all of this
Python has easy_install/pip
Ruby has gem
JavaScript has npm
Java has Maven
Objective-C has ?
Enter Cocoapods
- Library dependency management for Xcode projects
- Community maintained
- Written in Ruby
- Modelled after Rubygems
- gem install cocoapods
Great, how does it work?
Create an Xcode project
Add a Podfile to your project folder
Add your dependency to it
pod install
Compiles your library dependency as a static library
Takes your project and puts it into an Xcode workspace
Adds static library to workspace
You open App.xcworkspace instead of App.xcproject
Profit!!1!
Anatomy of a podspec
Pod::Spec.new do |s|
s.name = 'MBProgressHUD'
s.version = '0.5'
s.platform = :ios
s.license = 'MIT'
s.summary = 'An iOS activity indicator view.'
s.homepage = 'https://github.com/matej/MBProgressHUD'
s.author = { 'Matej Bukovinski' => 'matej@bukovinski.com',
'Jonathan George' => 'jonathan@jdg.net' }
s.source = { :git => 'https://github.com/jdg/MBProgressHUD.git', :tag => '0.5' }
s.source_files = '*.{h,m}'
s.framework = "CoreGraphics"
end
In-house development
Referencing a local folder in a podspec
Host your own repository of podspecs
Random feature overview
Last night: 589 pods
Contributing is easy, just fork and create a pull request
Handles difference between ARC and non-ARC dependencies
:test/:dev scopes available
iOS and OSX dependencies