Adding pods to nested targets in iOS Xcode

I had this confusion on how to add a dependency to a nested target via Cocoapods. This may helps someone. Here is how I did it.

I had this weird structure in one of my project.

SO, I wanted to add a framework to the InnerTarget via pods.

The InnerTarget is a framework target inside TalkTab project which is added as a subproject to the MainTarget workspace.

I tried different ways. Like the given podfile below.

This might work . But for the custom pods framework that I had to add, it was throwing some error.

This is what I ended up doing.

In the below line, we need to follow the folderName/Projectname.xcodeproj format.

You can know more about configuring the podfile from the cocoapods official documentation here:

  1. https://guides.cocoapods.org/using/the-podfile.html
  2. https://guides.cocoapods.org/syntax/podfile.html#podfile

Hope it might help someone. thanks for reading.

That’s it.

Enjoy!!

If you enjoyed reading this post, please share and give some claps so others can find it 👏👏👏👏👏 !!!!

You can follow me on Medium for fresh articles. Also, connect with me on LinkedIn.

If you have any comment, question, or recommendation, feel free to post them in the comment section below!