Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to add a local dependency to .podspec file?

I'm using cocoapods now I would like to add a local pod dependency in my project, something like:

s.dependency = 'my pod', :path => '' 

but I think is not possibile, some ideas?

like image 421
Luca Becchetti Avatar asked Sep 05 '17 10:09

Luca Becchetti


People also ask

What is local Podspec?

A Podspec, or Spec, describes a version of a Pod library. We can use a local path to a directory on your computer and write a Podspec in that directory and use CocoaPods. This is called local podsec.


1 Answers

I have faced with the same issue and after lot of googling and asking on the CocoaPods github I have finally found the suitable answer.

It's not possible to set a local pod as a dependency, but it's possible to set a pod's source for a specific Podfile, which will work the same way.

E.g., in your podspec, you still have ()

s.dependency = 'my pod', '~> 1.0' # or whatever version you have 

Then in your Example/demo/test project's Podfile:

pod 'my pod', :path => '/path/to/the/local/my_pod' 

Then just run pod install and you will see both pods as a Development pods.

This way is very useful when you're developing 2 pods (one of which is dependend on the other) simultaneously, yet for release you will still have to publish your pod to the repo (either CocoaPods or a private repo).

like image 87
norlin Avatar answered Oct 13 '22 07:10

norlin