Search code examples
iosxcodeframeworkscocoapodspodfile

Automatically select proper path to local CocoaPods framework


I have a local framework. Since I work from different computers - I have different local paths to this framework. So, whenever I build it on another machine - I need to change the path. That is how I change it:

target 'SomeTarget' do
#    pod 'SomeFramework', :path => 'some/other/local/path'
    pod 'SomeFramework', :path => 'some/local/path'
end

Is there some way to write both paths and the proper path will be selected automatically? Or any other solution which will help to forget about manual daily podfile changes.


Solution

  • You can set environment variable. For me (I use zsh), it's .zshrc file in my root directory where I set the environment variable.

    Example:

    In .zshrc file add the next line:

    export PATH_TO_SOME_FRAMEWORK="some/local/path"
    

    And after that you can use environment variable in podfile this way:

    target 'SomeTarget' do
        pod 'SomeFramework', :path => ENV['PATH_TO_SOME_FRAMEWORK']
    end