Method: Pod::Podfile::DSL#abstract_target

Defined in:
lib/cocoapods-core/podfile/dsl.rb

#abstract_target(name) ⇒ void

This method returns an undefined value.

Defines a new abstract target that can be used for convenient target dependency inheritance.

Examples:

Defining an abstract target


abstract_target 'Networking' do
  pod 'AlamoFire'

  target 'Networking App 1'
  target 'Networking App 2'
end

Defining an abstract_target wrapping Pods to multiple targets


# Note: There are no targets called "Shows" in any of this workspace's Xcode projects
abstract_target 'Shows' do
  pod 'ShowsKit'

  # The target ShowsiOS has its own copy of ShowsKit (inherited) + ShowWebAuth (added here)
  target 'ShowsiOS' do
    pod 'ShowWebAuth'
  end

  # The target ShowsTV has its own copy of ShowsKit (inherited) + ShowTVAuth (added here)
  target 'ShowsTV' do
    pod 'ShowTVAuth'
  end

  # Our tests target has its own copy of
  # our testing frameworks, and has access
  # to ShowsKit as well because it is
  # a child of the abstract target 'Shows'

  target 'ShowsTests' do
    inherit! :search_paths
    pod 'Specta'
    pod 'Expecta'
  end
end

Parameters:

  • name (Symbol, String)

    the name of the target.



515
516
517
518
519
520
# File 'lib/cocoapods-core/podfile/dsl.rb', line 515

def abstract_target(name)
  target(name) do
    abstract!
    yield if block_given?
  end
end