Search code examples
iosxcodeopen-source

Modify an open source library installed with Cocoapods


I have an open source library that allows me to make modifications but the open source project is installed using "pod install". If I were to push then pull from Github then all my modifications would be erased because the open source library was installed with CocoaPods. I tried moving the library into my project directory manually then erasing the library in my Podfile but I'm not sure if this is the correct way or if there's an easier process.

So far even after deleting the library from my Podfile, I still get an error message that says... "ld: library not found for (the library name)" clang: error: linker command failed etc..

Sorry if this is a dumb question (Is there a way without storing the pod directory on git)


Solution

  • You should add the CocoaPods on under Source Control. That means that you should add everything from your project under Source Control and ignore the files you don't want under .gitignore file.

    Creating a .gitignore file

    cd yourProjectDirectory
    touch .gitignore
    open -e .gitignore
    

    On GitHub you a list of things that are recommended to be put on .gitignore, depending on your programming language that you are using.

    Adding everything under Source Control

    cd yourProjectDirectory
    git add . //This line will add every recognized file under Repo
    

    Now you are free on your customizations

    You can make your own customizations and push the changes on repo. And if someone will add a new pod under podfile, then installing it, will not affect the current version of your file, CocoaPods automatically on the first run generates a podfile.lock, which keeps track of your Pods

    More info: podfile.lock