If you use Cocoapods and use_frameworks !, should I use the Obj-C bridge header?

This link says no.

But this example only applies to Swift classes. In my project that uses use_frameworks!, I have a quick class that uses the objective-c class. Both of these classes are in the same directory in my local development unit. Without a header, how can the swift class use the objective-c class?

To clarify: The question is not whether Swift can import frameworks. I know this is possible. The question is twofold:

  • Should I use the bridge header if I use use_frameworks!? Or, using the bridge header, cause unforeseen problems, as indicated in the post I linked above?
  • If I cannot use the bridge header, then I need to import the objective-c (not framework) class from the swift class, and both of these classes are in the same structure. I do not know how this is possible even without a bridge header.
+4
source share
1 answer

The short answer is yes .

This has nothing to do with use_frameworks!, it is due to the fact that your Obj-C-backs are for Swift .

See examples:

+1
source

Source: https://habr.com/ru/post/1626073/


All Articles