The module map file that should be used when this pod is integrated as a framework.
‘false` indicates that the default CocoaPods `modulemap` file should not be generated.
‘true` is the default and indicates that the default CocoaPods `modulemap` file should be generated.
By default, CocoaPods creates a module map file based upon the public headers in a specification.
A hash of on demand resources that should be copied into the target bundle. Resources specified here will automatically become part of the resources build phase of the target this pod is integrated into.
If no category is specified then ‘:download_on_demand` is used as the default.
A path to a prefix header file to inject in the prefix header of the pod project. ‘false` indicates that the default CocoaPods prefix header should not be generated. `true` is the default and indicates that the default CocoaPods prefix header should be generated.
The file path options is __not recommended__ as Pods should not pollute the prefix header of other libraries or of the user project.
The path to the prefix header file or whether to disable prefix_header generation.
A bash script that will be executed after the Pod is downloaded. This command can be used to create, delete and modify any file downloaded and will be ran before any paths for other file attributes of the specification are collected.
This command is executed before the Pod is cleaned and before the Pods project is created. The working directory is the root of the Pod.
If the pod is installed with the ‘:path` option this command will not be executed.
sed -i 's/MyNameSpacedHeader/Header/g' ./**/*.h
sed -i 's/MyNameOtherSpacedHeader/OtherHeader/g' ./**/*.h
Parameters:
command
(
String
)
the prepare command of the pod.
spec
.
preserve_path
=
'
IMPORTANT.txt
'
spec
.
preserve_paths
=
'
Frameworks/*.framework
'
Parameters:
preserve_paths
(
String
,
Array<String>
)
the paths that should be not cleaned.
A list of file patterns that should be used to mark private headers.
These patterns are matched against the public headers (or all the headers if no public headers have been specified) to exclude those headers which should not be exposed to the user project and which should not be used to generate the documentation. When the library is built, these headers will appear in the build directory.
Header files that are not listed as neither public nor project or private will be treated as private, but in addition will not appear in the build directory at all.
# File 'lib/cocoapods-core/specification/dsl.rb', line 1312
attribute :private_header_files,
:container => Array,
:file_patterns => true
A list of file patterns that should be used to mark project headers.
These patterns are matched against the public headers (or all the headers if no public headers have been specified) to exclude those headers which should not be exposed to the user project and which should not be used to generate the documentation. When the library is built, these headers will
not
appear in the build directory.
# File 'lib/cocoapods-core/specification/dsl.rb', line 1282
attribute :project_header_files,
:container => Array,
:file_patterns => true
A list of file patterns that should be used as public headers.
These patterns are matched against the source files to include headers that will be exposed to the user’s project and from which documentation will be generated. When the library is built, these headers will appear in the build directory. If no public headers are specified then
all
the headers in source_files are considered public.
# File 'lib/cocoapods-core/specification/dsl.rb', line 1256
attribute :public_header_files,
:container => Array,
:file_patterns => true
# File 'lib/cocoapods-core/specification/dsl.rb', line 1683
attribute :requires_app_host,
:types => [TrueClass, FalseClass],
:default_value => false,
:spec_types => [:test]
‘requires_arc` allows you to specify which source_files use ARC. This can either be the files which support ARC, or true to indicate all of the source_files use ARC.
Files which do not use ARC will have the ‘-fno-objc-arc` compiler flag.
The default value of this attribute is ‘true`.
spec
.
requires_arc
=
'
Classes/Arc
'
spec
.
requires_arc
=
[
'
Classes/*ARC.m
'
,
'
Classes/ARC.mm
'
]
Parameters:
(
Bool
,
String
,
Array<String>
)
whether the source files require ARC.
attribute
:requires_arc
,
:types
=>
[
TrueClass
,
FalseClass
,
String
,
Array
]
,
:file_patterns
=>
true
,
:default_value
=>
true
,
:inherited
=>
true
This attribute allows to define the name and the file of the resource bundles which should be built for the Pod. They are specified as a hash where the keys represent the name of the bundles and the values the file patterns that they should include.
For building the Pod as a static library, we strongly
recommend
library developers to adopt resource bundles as there can be name collisions using the resources attribute.
The names of the bundles should at least include the name of the Pod to minimise the chance of name collisions.
To provide different resources per platform namespaced bundles
must
be used.
Examples:
spec
.
ios
.
resource_bundle
=
{
'
MapBox
'
=>
'
MapView/Map/Resources/*.png
'
}
spec
.
resource_bundles
=
{
'
MapBox
'
=>
[
'
MapView/Map/Resources/*.png
'
]
,
'
MapBoxOtherResources
'
=>
[
'
MapView/Map/OtherResources/*.png
'
]
Parameters:
resource_bundles
(
Hash{String=>String}
,
Hash{String=>Array<String>}
)
A hash where the keys are the names of the resource bundles and the values are their relative file patterns.
# File 'lib/cocoapods-core/specification/dsl.rb', line 1448
attribute :resource_bundles,
:types => [String, Array],
:container => Hash,
:file_patterns => true,
:singularize => true
A list of resources that should be copied into the target bundle.
For building the Pod as a static library, we strongly
recommend
library developers to adopt [resource bundles](
guides.cocoapods.org/syntax/podspec.html#resource_bundles
) as there can be name collisions using the resources attribute. Moreover, resources specified with this attribute are copied directly to the client target and therefore they are not optimised by Xcode.
spec
.
resource
=
'
Resources/HockeySDK.bundle
'
spec
.
resources
=
[
'
Images/*.png
'
,
'
Sounds/*
'
]
Parameters:
resources
(
String
,
Array<String>
)
The resources shipped with the Pod.
spec
.
scheme
=
{
:launch_arguments
=>
[
'
Arg1
'
]
}
spec
.
scheme
=
{
:launch_arguments
=>
[
'
Arg1
'
,
'
Arg2
'
]
,
:environment_variables
=>
{
'
Key1
'
=>
'
Val1
'
}
}
Parameters:
scheme
(
Hash
)
the scheme configuration to be used for this specification.
spec
.
screenshot
=
'
http://dl.dropbox.com/u/378729/MBProgressHUD/1.png
'
spec
.
screenshots
=
[
'
http://dl.dropbox.com/u/378729/MBProgressHUD/1.png
'
,
'
http://dl.dropbox.com/u/378729/MBProgressHUD/2.png
'
]
Parameters:
screenshots
(
String
)
An URL for the screenshot of the Pod.
This attribute allows to define a script phase to execute as part of compilation of the Pod. Unlike a prepare command, script phases execute as part of ‘xcodebuild` they can also utilize all environment variables that are set during compilation.
A Pod can provide multiple script phases to execute and they will be added in the order they were declared and after taking into consideration their execution position setting.
Note
In order to provide visibility and awareness of the contents of all script phases, a warning will be presented to the user upon installing your pod if it includes any script phases.
Examples:
spec
.
script_phase
=
{
:name
=>
'
Hello World
'
,
:script
=>
'
echo "Hello World"
'
}
spec
.
script_phase
=
{
:name
=>
'
Hello World
'
,
:script
=>
'
echo "Hello World"
'
,
:execution_position
=>
:before_compile
}
spec
.
script_phase
=
{
:name
=>
'
Hello World
'
,
:script
=>
'
puts "Hello World"
'
,
:shell_path
=>
'
/usr/bin/ruby
'
}
spec
.
script_phase
=
{
:name
=>
'
Hello World
'
,
:script
=>
'
echo "Hello World"
'
,
:input_files
=>
[
'
/path/to/input_file.txt
'
]
,
:output_files
=>
[
'
/path/to/output_file.txt
'
]
spec
.
script_phase
=
{
:name
=>
'
Hello World
'
,
:script
=>
'
echo "Hello World"
'
,
:input_file_lists
=>
[
'
/path/to/input_files.xcfilelist
'
]
,
:output_file_lists
=>
[
'
/path/to/output_files.xcfilelist
'
]
spec
.
script_phases
=
[
{
:name
=>
'
Hello World
'
,
:script
=>
'
echo "Hello World"
'
}
,
{
:name
=>
'
Hello Ruby World
'
,
:script
=>
'
puts "Hello World"
'
,
:shell_path
=>
'
/usr/bin/ruby
'
}
,
Parameters:
script_phases
(
Array<Hash{Symbol=>String}>
)
An array of hashes where each hash represents a single script phase.
spec
.
social_media_url
=
'
https://twitter.com/cocoapods
'
spec
.
social_media_url
=
'
https://groups.google.com/forum/#!forum/cocoapods
'
Parameters:
social_media_url
(
String
)
the social media URL.
spec
.
source
=
{
:git
=>
'
https://github.com/AFNetworking/AFNetworking.git
'
,
:tag
=>
spec
.
version
.
to_s
}
Using a tag prefixed with ‘v’ and submodules.
spec
.
source
=
{
:git
=>
'
https://github.com/typhoon-framework/Typhoon.git
'
,
:tag
=>
"
v
#{
spec
.
version
}
"
,
:submodules
=>
true
}
Using Subversion with a tag.
spec
.
source
=
{
:svn
=>
'
http://svn.code.sf.net/p/polyclipping/code
'
,
:tag
=>
'
4.8.8
'
}
Using Mercurial with the same revision as the spec’s semantic version string.
spec
.
source
=
{
:hg
=>
'
https://bitbucket.org/dcutting/hyperbek
'
,
:revision
=>
"
#{
s
.
version
}
"
}
Using HTTP to download a compressed file of the code. It supports zip, tgz, bz2, txz and tar.
spec
.
source
=
{
:http
=>
'
http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip
'
}
Using HTTP to download a file using a hash to verify the download. It supports sha1 and sha256.
spec
.
source
=
{
:http
=>
'
http://dev.wechatapp.com/download/sdk/WeChat_SDK_iOS_en.zip
'
,
:sha1
=>
'
7e21857fe11a511f472cfd7cfa2d979bd7ab7d96
'
}
Overloads:
#
source=
(git) ⇒
Object
spec
.
source_files
=
'
Classes/**/*.{h,m}
'
spec
.
source_files
=
'
Classes/**/*.{h,m}
'
,
'
More_Classes/**/*.{h,m}
'
Parameters:
source_files
(
String
,
Array<String>
)
the source files of the Pod.
# File 'lib/cocoapods-core/specification/dsl.rb', line 537
root_attribute :static_framework,
:types => [TrueClass, FalseClass],
:default_value => false
Represents specification for a module of the library.
Subspecs participate on a dual hierarchy.
On one side, a specification automatically inherits as a dependency all it children ‘sub-specifications’ (unless a default subspec is specified).
On the other side, a ‘sub-specification’ inherits the value of the attributes of the parents so common values for attributes can be specified in the ancestors.
Although it sounds complicated in practice it means that subspecs in general do what you would expect:
pod 'ShareKit', '2.0'
Installs ShareKit with all the sharers like ‘ShareKit/Evernote`, `ShareKit/Facebook`, etc, as they are defined as subspecs.
pod 'ShareKit/Twitter', '2.0'
pod 'ShareKit/Pinboard', '2.0'
Installs ShareKit with only the source files for ‘ShareKit/Twitter`, `ShareKit/Pinboard`. Note that, in this case, the ‘sub-specifications’ to compile need the source files, the dependencies, and the other attributes defined by the root specification. CocoaPods is smart enough to handle any issues arising from duplicate attributes.
s.subspec 'Core' do |cs|
cs.dependency 'RestKit/ObjectMapping'
cs.dependency 'RestKit/Network'
cs.dependency 'RestKit/CoreData'
s.subspec 'ObjectMapping' do |os|
Nested subspecs.
Pod::Spec.new do |s|
s.name = 'Root'
s.subspec 'Level_1' do |sp|
sp.subspec 'Level_2' do |ssp|
# File 'lib/cocoapods-core/specification/dsl.rb', line 1642
def subspec(name, &block)
subspec = Specification.new(self, name, &block)
@subspecs << subspec
subspec
A short (maximum 140 characters) description of the Pod.
The description should be short, yet informative. It represents the tag line of the Pod and there is no need to specify that a Pod is a library (they always are).
The summary is expected to be properly capitalised and containing the correct punctuation.
The versions of Swift that the specification supports. A version of ‘4’ will be treated as ‘4.0’ by CocoaPods and not ‘4.1’ or ‘4.2’.
Note The Swift compiler mostly accepts major versions and sometimes will honor minor versions. While CocoaPods allows specifying a minor or patch version it might not be honored fully by the Swift compiler.
spec.swift_versions = ['3.0']
spec.swift_versions = ['3.0', '4.0', '4.2']
spec.swift_version = '3.0'
spec
.
swift_version
=
'
3.0
'
,
'
4.0
'
Parameters:
swift_versions
(
String
,
Array<String>
)
# File 'lib/cocoapods-core/specification/dsl.rb', line 158
root_attribute :swift_versions,
:container => Array,
:singularize => true
spec
.
test_spec
do
|
test_spec
|
test_spec
.
source_files
=
'
NSAttributedString+CCLFormatTests.m
'
test_spec
.
dependency
'
Expecta
'
# File 'lib/cocoapods-core/specification/dsl.rb', line 1761
def test_spec(name = 'Tests', &block)
subspec = Specification.new(self, name, true, &block)
@subspecs << subspec
subspec
Specifies flags to add to the final aggregate target xcconfig file, which propagates to non-overridden and inheriting build settings to the integrated user targets.
This attribute is __not recommended__ as Pods should not pollute the build settings of the user project and this can cause conflicts.
Multiple definitions for build settings that take multiple values will be merged. The user is warned on conflicting definitions for custom build settings and build settings that take only one value.
Typically clang compiler flags or precompiler macro definitions go in here if they are required when importing the pod in the user target. Note that, this influences not only the compiler view of the public interface of your pod, but also all other integrated pods alongside to yours. You should always prefer [‘pod_target_xcconfig`]( guides.cocoapods.org/syntax/podspec.html#pod_target_xcconfig), which can contain the same settings, but only influence the toolchain when compiling your pod target.
# File 'lib/cocoapods-core/specification/dsl.rb', line 958
attribute :user_target_xcconfig,
:container => Hash,
:inherited => true
spec.ios.vendored_frameworks = 'Frameworks/MyFramework.framework'
spec
.
vendored_frameworks
=
'
MyFramework.framework
'
,
'
TheirFramework.xcframework
'
Parameters:
vendored_frameworks
(
String
,
Array<String>
)
A list of framework bundles paths.
# File 'lib/cocoapods-core/specification/dsl.rb', line 1334
attribute :vendored_frameworks,
:container => Array,
:file_patterns => true,
:singularize => true
spec
.
ios
.
vendored_library
=
'
Libraries/libProj4.a
'
spec
.
vendored_libraries
=
'
libProj4.a
'
,
'
libJavaScriptCore.a
'
Parameters:
vendored_libraries
(
String
,
Array<String>
)
A list of library paths.
# File 'lib/cocoapods-core/specification/dsl.rb', line 1357
attribute :vendored_libraries,
:container => Array,
:file_patterns => true,
:singularize => true
spec
.
weak_framework
=
'
Twitter
'
spec
.
weak_frameworks
=
'
Twitter
'
,
'
SafariServices
'
Parameters:
weak_frameworks
(
String
,
Array<String>
)
A list of frameworks names.