Class: Pod::Generator::UmbrellaHeader

Inherits:
Header
  • Object
show all
Defined in:
lib/cocoapods/generator/umbrella_header.rb

Overview

Generates an umbrella header file for clang modules, which are used by dynamic frameworks on iOS 8 and OSX 10.10 under the hood.

If the target is a +PodTarget+, then the umbrella header is required to make all public headers in a convenient manner available without the need to write out header declarations for every library header.

Instance Attribute Summary collapse

Attributes inherited from Header

#imports, #module_imports, #platform

Instance Method Summary collapse

Methods inherited from Header

#save_as

Constructor Details

#initialize(target) ⇒ UmbrellaHeader

Initialize a new instance

Parameters:

  • target (Target)

    @see target



20
21
22
23
# File 'lib/cocoapods/generator/umbrella_header.rb', line 20

def initialize(target)
  super(target.platform)
  @target = target
end

Instance Attribute Details

#targetTarget (readonly)

Returns the target, which provides the product name.

Returns:

  • (Target)

    the target, which provides the product name



13
14
15
# File 'lib/cocoapods/generator/umbrella_header.rb', line 13

def target
  @target
end

Instance Method Details

#generateString

Generates the contents of the umbrella header according to the included pods.

Returns:

  • (String)


30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cocoapods/generator/umbrella_header.rb', line 30

def generate
  result = super

  result << "\n"

  result << <<-eos.strip_heredoc
  FOUNDATION_EXPORT double #{target.product_module_name}VersionNumber;
  FOUNDATION_EXPORT const unsigned char #{target.product_module_name}VersionString[];
  eos

  result << "\n"

  result
end