Install CocoaPods Block Dependencies

I did not find the answer to this in the subfile documents, so I'm not sure if this is possible.

I want to install a CocoaPods project that has 3 dependencies. I add it to my subfile:

pod 'IDMPhotoBrowser'

and run the installation:

 $ pod install Installing DACircularProgress (2.1.0) … Installing IDMPhotoBrowser (1.2) … Installing SVProgressHUD (0.9) 

However, I have a hacked version of SVProgressHUD in my project that contains code not in the current repo. In addition, SVProgressHUD 0.9 since January, and since then there are months of additional commits. Instead, I would like to use my manually added version.

Is it possible to indicate in my subfile that SVProgressHUD should not be installed in order for my manually added version to be used? Or do I just need to remove it manually every time I run pod install ?

Alternatives

I know that I can upload my fork to github and do something like:

 pod 'SVProgressHUD', :git => '<my git repo>', :commit => '<my sha>' 

but I hope you don’t need to download code to get Cocoapods to do what I want.

+4
source share
1 answer

It's not so much about blocking a dependency, but overriding it with your own. This means CocoaPods must find your local copy of SVProgressHUD before activating IDMPhotoBrowser and look for SVProgressHUD in the master spec repository.

You can achieve the desired setting by declaring your version of SVProgressHUD first in your subfile using local podspec :

  • Your user version should be in a subdirectory of your project with a valid podspec in the root directory of this directory, for example External/SVProgressHUD/SVProgressHUD.podspec .
  • Update your subfile as follows:

     pod 'SVProgressHUD', :path => 'External/SVProgressHUD' # this needs to be declared first pod 'IDMPhotoBrowser' # your custom pod will be used as the dependency here 

If you don’t have a local podspec, you can take a copy of version 0.9 of SVProgressHUD (and change it if necessary to compile the code you added).

+7
source

Source: https://habr.com/ru/post/1498861/


All Articles