2

How can I use non public swift classes if I have an Objective C framework, not app. For introducing swift code in a objective C project I follow this steps:

  • Create swift file and not create a bridging header because using bridging headers with framework targets is unsupported.
  • Create a swift simple class. The class inherit from NSObject and has @objc tag.
  • Enable the following configurations:
    • Defines Module : YES
    • Always Embed Swift Standard Libraries : YES
    • Install Objective-C Compatibility Header : YES
  • Import the umbrella file ("ModuleName-Swift.h") where you want to use the swift class.
  • If the swift classes are public it works but this classes are accessible from outside, for example the app that uses the framework.
  • If the swift classes are non public they aren't accessible in the objective-c files in the framework.

The solution for this problem if the project is an app and not a framework is creating a bridging header. I'm searching for a solution for this problem for a framework.

LittleBobbyTables - Au Revoir
  • 32,008
  • 25
  • 109
  • 114
Radost
  • 845
  • 7
  • 11

0 Answers0