iamkaan iamkaan - 1 month ago 10
Swift Question

Using local copy of a framework in podfile if exists

I have a framework and a project where I'm using my framework in. I'm trying to use the framework that is locally built during development. Is there a way to do something like:

if

my-local-library-path
exists, do this:

pod 'MyLibraryName', :path => "my-local-library-path"


else, do this:

pod 'MyLibraryName', git: 'https://github.com/mygithuburl', tag: '0.0.1'

Answer

Since a Podfile is actually Ruby code, let's check if the file exists:

if File.exist?("complete-path-to-a-library-file")
    pod 'MyLibraryName', :path => "my-local-library-path"
else
    pod 'MyLibraryName', git: 'https://github.com/mygithuburl', tag: '0.0.1'
end
Comments