Podfile: Path of local pod relative to Projectpath possible?

25,673

Solution 1

Yes there is a way to do that, I have a project that use cocoapods and have custom pods in it, in the folder where you have your PodFile put your libraries folder and then modify your podFile to

pod 'ObjCPod', :path => 'libraries/LocalPod/'

Should work, Hope this helps

Solution 2

If you would like to develop a Pod in tandem with its client project you can use :path.

pod 'Alamofire', :path => '~/Documents/Alamofire'

Using this option CocoaPods will assume the given folder to be the root of the Pod and will link the files directly from there in the Pods project. This means that your edits will persist between CocoaPods installations. The referenced folder can be a checkout of your favourite SCM or even a git submodule of the current repo.

Note that the podspec of the Pod file is expected to be in that the designated folder.

Share:
25,673

Related videos on Youtube

Snerps
Author by

Snerps

Updated on July 09, 2022

Comments

  • Snerps
    Snerps almost 2 years

    I am trying to add local pods to my objective c iOS project. Is there a way to use the rootpath of my project as relative path? The only way I got it to work is by using something like this:

    pod 'ObjCPod', :path => '~/Documents/iOS-Projects/MyApp/libraries/LocalPod/'
    

    This wouldn't work if I moved the Project folder or tried to build the project on another machine.

    I would like to have something like this:

    pod 'ObjCPod', :path => '$(SRCROOT)/libraries/LocalPod/'
    

    Is there a way to do that?

    • Reinier Melian
      Reinier Melian almost 7 years
      Did you try my answer?
    • Snerps
      Snerps almost 7 years
      yeah, it worked perfectly. thank you very much
    • Reinier Melian
      Reinier Melian almost 7 years
      Your welcome, I am glad to help you, best regards