0

our project is growing fast so we are separating functionality into frameworks but I'm having some issue at compile time.

You see, we have a Main Project where we store the business logic and we plan to make a separate analytics framework which deals with all the "analytics logic". Btw, we also have Cocoapods as a dependency manager inside our Main Project.

So what I did was the following:

  1. Created a new Cocoa Touch Framework called MyAnalytics that now contains all the classes related to analytics that were previously in my Main Project.
  2. Added new files (aka. MyAnalytics.xcodeproj) into my Main Project like the image below.

enter image description here

  1. The problem is that when I try to build the Analytics Framework, I get an error at compile time where my classes can't import modules from Cocoapods.

    enter image description here

So, do you know what steps should I follow in order to compile and run the project?

Because as you can see I'm planning to generate the pods using the target of my Main Project, but somehow the pods should be “visible” to the rest of my custom frameworks.

Or should install Cocoapods for each Cocoa Touch Framework?

Btw, here is the Podfile located in my Main Project directory.

# Uncomment the next line to define a global platform for your project
platform :ios, '11'

inhibit_all_warnings!

target 'MainProject' do
  use_frameworks!
  /**My Pods**/
end

end

1 Answer 1

2

You probably also have to install pod for your Framework target, by add another target in your podfile and add pod stuff in there too:

platform :ios, '11.0'
use_frameworks!
inhibit_all_warnings!

def shared_pods 
pod 'A'
end

target 'MainProject' do
  use_frameworks!
  shared_pods
end

target 'Framework' do
  use_frameworks!
  shared_pods //Or just the required pod
end
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.