The Podfile is a specification that describes the dependencies of the
targets of one or more Xcode projects. The file should simply be named Podfile.
All the examples in the guides are based on CocoaPods version 1.0 and onwards.
A Podfile can be very simple, this adds Alamofire to a single target:
An example of a more complex Podfile linking an app and its test bundle:
source'https://github.com/CocoaPods/Specs.git'source'https://github.com/Artsy/Specs.git'platform:ios,'9.0'inhibit_all_warnings!target'MyApp'dopod'GoogleAnalytics','~> 3.1'# Has its own copy of OCMock# and has access to GoogleAnalytics via the app# that hosts the test targettarget'MyAppTests'doinherit!:search_pathspod'OCMock','~> 2.0.1'endendpost_installdo|installer|installer.pods_project.targets.eachdo|target|putstarget.nameendend
If you want multiple targets to share the same pods, use an abstract_target.
# There are no targets called "Shows" in any Xcode projectsabstract_target'Shows'dopod'ShowsKit'pod'Fabric'# Has its own copy of ShowsKit + ShowWebAuthtarget'ShowsiOS'dopod'ShowWebAuth'end# Has its own copy of ShowsKit + ShowTVAuthtarget'ShowsTV'dopod'ShowTVAuth'endend
There is implicit abstract target at the root of the Podfile, so you could write the above example as:
pod'ShowsKit'pod'Fabric'# Has its own copy of ShowsKit + ShowWebAuthtarget'ShowsiOS'dopod'ShowWebAuth'end# Has its own copy of ShowsKit + ShowTVAuthtarget'ShowsTV'dopod'ShowTVAuth'end
<Using the files from a folder local to the machine.
If you would like to develop a Pod in tandem with its client
project you can use :path.
Using this option CocoaPods will assume the given folder to be the
root of the Pod and will link the files directly from there in the
Pods project. This means that your edits will persist between CocoaPods
installations. The referenced folder can be a checkout of your favourite SCM or
even a git submodule of the current repo.