Method: Pod::Specification::DSL#subspec
- Defined in:
- lib/cocoapods-core/specification/dsl.rb
#subspec(name, &block) ⇒ Object
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.
1642 1643 1644 1645 1646 |
# File 'lib/cocoapods-core/specification/dsl.rb', line 1642 def subspec(name, &block) subspec = Specification.new(self, name, &block) @subspecs << subspec subspec end |