1

I have Main Project A and multiple customFramework B ,C etc. In that Main Project A I have All Pod and I need to share the same pod to customFramework B ,C etc. how should I implement the same pod to multiple customFramework? I don't want to implement a pod for a particular customFramework, I want to use the same pod of the Main Project.

how to implement this? Can anyone help me out? and is it possible?

H143
  • 43
  • 1
  • 6
  • your question is absolutely unclear. What do you mean by "implement the same pod"? – timbre timbre Aug 23 '22 at 14:12
  • @sfgblackwarkrts In the main project I am using a pod that is Firebase but the same pod should be used in customFramework . Firebase is only installed in the main Project and I am not installing Firebase in CustomFrameWork . That means Firebase Should Import in CustomFrameWork through Main Project. is it possible? – H143 Aug 23 '22 at 14:47
  • So how the "main project" is imported into "customFramework"? Do you create a pod from "main project" and add it to "customFramework"? If so, you just need to add `dependency` to "main project's" `podspec`. – timbre timbre Aug 23 '22 at 15:07
  • @sfgblackwarkrts customFramework is imported into the main project . yes pod is created from the main project . "main project" pod should use in customFramework – H143 Aug 23 '22 at 15:17
  • I think you are confused about terminology: if "customFramework is imported into the main project", you can't simultaneously use "main project" in customFramework - that's a deadlock. So maybe what you mean is : customFramework is a pod you import into main project, and main project is an app (not a pod / framework)? – timbre timbre Aug 23 '22 at 18:32
  • @sfgblackwarkrts ok Yes, the "main project" is my " App" . In the App I have a Pod that I want to use in CustomFramework. But I don't want to declare a pod again in customFramework. I want to use the same pod(App) for my CustomFramework . Is it possible to use? – H143 Aug 24 '22 at 03:20
  • ok, so what you need then is in `podspec` of "customFramework" declare that dependency `spec.dependency 'Firebase'` (+ whatever other 3rd-party pods it uses). Pretty much do what this person did: https://stackoverflow.com/questions/44290640/how-to-use-firebase-sdk-as-a-pod-dependency (except the bug they are talking about is already resolved it seems, so you should have no issues. Then in `podfile` of the "main project" you do `pod 'Firebase'` etc as usual. – timbre timbre Aug 24 '22 at 13:48

1 Answers1

1

You can put common pods in outside specific targets in your Podfile:

use_frameworks!
inhibit_all_warnings!

pod 'Firebase' # will be included in all targets

target 'MainProject' do
  pod 'Alamofire' # included only in MainProject
end

target 'FrameworkB' do
  pod 'PhoneNumberKit' # included only in FrameworkB
end
Yonat
  • 4,382
  • 2
  • 28
  • 37