Issues to access Swift code located in ObjC static library

I have an iOS app with the following configuration:

  • My own ObjC static library project - MyStaticLib
  • My own ObjC app target project - MyApp
  • I have both projects in the same Xcode workspace so that MyStaticLib is linked successfully to MyApp
  • Both projects have a mix of ObjC and Swift code successfully working.

Currently:

  • MyStaticLib: ObjC code can access Swift code and vice versa
  • MyApp: ObjC code can access Swift code and vice versa
  • ObjC code from MyApp can access ObjC code from MyStaticLib (This is achieved by adding Copy Files in Build Phases at MyStaticLib project settings with the ObjC header files)

Objective:

  • Swift code located in MyApp to access Swift code located in MyStaticLib

Issues:

  • If I'm trying to call a public Swift function located in MyStaticLib from MyApp, I get Cannot find 'YYY' in scope.
  • If I'm adding import MyStaticLib, I get dozens of Duplicate interface definition for class 'ZZZ'

Any idea how to resolve this?

Issues to access Swift code located in ObjC static library
 
 
Q