
A Podfile is a specification of dependencies used for targets of one or more Xcode Projects.
Here is an example of simple Podfile, this adds GoogleAnalytics to a single target:
target ‘MyAppiOS’ do
use_frameworks!
pod ‘GoogleAnalytics’, ‘~> 3.1’
end
Assume you have multiple target then the Podfile look like this.
target ‘MyAppiOS’ do
pod ‘GoogleAnalytics’, ‘~> 3.1’
pod ‘Firebase’, ‘~> 2.0.1’
end
target ‘MyApptvOS’ do
pod ‘Firebase’, ‘~> 2.0.1’
end
See we have common dependency Firebase used below each one of the target. To simplify things cocoa-pods provided Abstract-target feature.
abstract_target ‘NoActualTarget’ do
pod ‘Firebase’, ‘~> 2.0.1’target ‘MyAppiOS’ do
pod ‘GoogleAnalytics’, ‘~> 3.1’
end
target ‘MyApptvOS’ do
end
end
You have to use abstract_target keyword following a title ‘NoActualTarget’ it actually doesn’t exit in our Ccode projects. It looks like a container with dummy title. There is an another way to use common dependency libraries without abstract_target.
pod ‘Firebase’, ‘~> 2.0.1’
target ‘MyAppiOS’ do
pod ‘GoogleAnalytics’, ‘~> 3.1’
end
target ‘MyApptvOS’ do
end