Reputation: 2500
There is a command podspec
in Podfile (documentation)
Example from the link:
podspec
podspec :name => 'QuickDialog'
podspec :path => '/Documents/PrettyKit/PrettyKit.podspec'
What is really mean? a example of project structure that use podfile
will be really appreciated
Upvotes: 2
Views: 2373
Reputation: 524
I know this is old , but I stumble on this question , while learning Cocoapods distribution.
So here is the answer:
As the documentation says. If you define this in your Podfile. All dependencies that you define in your podspec will be installed.
Example: in your .podspec file you have:
spec.dependency "RealmSwift", "~> 0.99.0"
spec.dependency "Starscream", "~> 1.1.3"
Basically, this means your library/framework uses this dependencies.
When you are working on your library, you still need to install this dependencies. So you define them in the Podfile of your library:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'YourLibrary' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for YourLibrary
pod "RealmSwift", "~> 0.99.0"
pod "Starscream", "~> 1.1.3"
target 'YourLibraryTest' do
inherit! :search_paths
# Pods for testing
end
end
now instead of re-writing all of those dependency that your library needed. You could just use
# Pods for YourLibrary
podspec
this will look through your library/frameworks podspec file. And download the dependencies that were defined.
From the documentation of Cocoapods:
It is intended to be used by the project of a library.
Upvotes: 1