0
votes

In short:

I get this error when I import my private pod (PrivatePod_Commons) into another private pod (PrivatePod_X).

No such module 'PrivatePod_Commons'

Details:

As shown in the below diagram, I want to have my private CocoaPods structure.

I am able to develop PrivatePod_Commons and able to pod lint push.

Now I am developing PrivatePod_X in which I need to include PrivatePod_Commons. I developed PrivatePod_X by including as dependency and pod lint worked. But, when I included PrivatePod_Commons into PrivatePod_X as mentioned below, I get error.

  s.dependency 'PrivatePod_Commons', '~> '1.0.5'

The problem is that in PrivatePod_X, I can't import PrivatePod_Commons.

import PrivatePod_Commons

/* The above line gives error - No such module 'PrivatePod_Commons' */

How do I resolve it?

         ┌───────────────────┐
         │  iOS Application  │
         └────▲────────▲─────┘
              │        │
┌─────────────┴──┐ ┌───┴──────────┐
│  PrivatePod_X  │ │ PrivatePod_Y │
└─────────────▲──┘ └───▲──────────┘
              │        │
              │        │
        ┌────────────────────┐
        │ PrivatePod_Commons │
        └────────────────────┘

Podspec for Commons

Pod::Spec.new do |s|
  s.name                  = 'PrivatePod_Commons'
  s.version               = '1.0.5'
  s.summary               = 'Common components'
  ...
  ...
  s.ios.deployment_target = '13.2'
  s.swift_version         = ['4.2', '5.0']
  s.static_framework      = true

  s.source_files          = 'PrivatePod_Commons/**/*.{h,m,swift,c}'
  s.exclude_files         = 'PrivatePod_Commons/PrivatePod_Commons'
  s.resources = "PrivatePod_Commons/**/*.{storyboard,xib,xcassets,png,jpg,ttf}"
  
  # UI
  s.dependency 'FFPopup'
  s.dependency 'Firebase/Analytics'
  s.dependency 'Firebase/Core'
  s.dependency 'Firebase/Crashlytics'
  s.dependency 'Firebase/Messaging'
  s.dependency 'FloatingPanel'
  s.dependency 'Gallery'
  s.dependency 'Giphy'
  s.dependency 'GooglePlaces', '4.1.0'
  s.dependency 'Lightbox'
  s.dependency 'lottie-ios'
  s.dependency 'SwiftyGif'               # Gif
  s.dependency 'SwipeVC'
  s.dependency 'TTSegmentedControl'
end

Podspec for PrivatePod_X

Pod::Spec.new do |s|
  s.name                  = 'PrivatePod_X'
  s.version               = '0.1.5'
  s.summary               = 'X components'
  ...
  ...
  s.ios.deployment_target = '13.2'
  s.swift_version         = ['4.2', '5.0']
  s.static_framework      = true

  s.source_files          = 'PrivatePod_X/**/*.{h,m,swift,c}'
  s.exclude_files         = 'PrivatePod_X/PrivatePod_X'
  s.resources = "PrivatePod_X/**/*.{storyboard,xib,xcassets,png,jpg,ttf}"
  
  # UI
  s.dependency 'PrivatePod_Commons', '~> 1.0.5'
end