ioscocoapodsxcode10xcode10.2

Developing Pod for iOS project - improve work methodologies


I'm working on Pod projects at work, the main goal is to isolate portions of the main app into separate libraries.

The thing is that the process of developing a pod, then testing it on the main app seems to be too slow. Much slower than developing the main project by itself for instance.

My main complain is that Xcode 10 requires me to do the following in order for the main project to get the changes:

  1. To rebuild the pod.
  2. Run pod update on my main project.
  3. Index and rebuild the main project

I was wondering if someone knows how to avoid step 2 (which also reduces the indexing of the main project from step 3).


Solution

  • The correct work methodology that has best worked for me is the following:

    1) Build system: credit goes to @qtngo.

    To change to the legacy build system. That way Xcode knows to build the changes as you go and doesn't require rebuilding everything.

    how to do it: Go to File -> Workspace/Project Settings -> Build System - here change to legacy.

    2) In PodFile set the pod referencing a local library:

     if development
        pod 'YourPod', :path => '../your_pod'
      else
        pod 'YourPod', :git => 'https://user@bitbucket.org/company/your_pod.git'
      end
    

    Then, run pod install after deleting the cached pod data and develop on the created workspace.

    3) Creating files You can create new files in your pod development folder right through the main project workspace. Just be aware that the files are going to be registered at in the pod project file and NOT in your pod project file. So simply open in parallel Xcode instance your pod project and add the files(or just do it before committing but it can get messy in case of many new files).

    4) Checking everything:

    4.1) Commit and push your pod.

    4.2) Clear the pod data from the main project(Pods folder + Podfile.lock) and set the flag development to false. We need this step because the current workspace contains your pod as a development pod in a designated development folder. So hit pod install to get the remote pod with your recent changes. If everything compiles and run as expected feel free to commit+push the pod as part of the app.