0

I have a framework written in Swift and it has 2 versions. In 1st version it has class “NewClass” and in 2nd it has NOT.

Now when I import that class into my Objective-C project I need to check if that “NewClass” exists or not. If yes - then compile the block of code if not - to skip it.

But I need to do that by using precompile macros, not runtime, as in runtime case the project does not see the class and not compiles.

How can I achieve that?

Can I check like this, but for the class itself, not header file?

#if __has_include(<MyFramework/MyFramework-Swift.h>)

Like if has_include NewClass?

iamalizade
  • 228
  • 1
  • 5
  • This is a duplicate of https://stackoverflow.com/questions/75663017/has-include-check-fails-but-the-class-is-there/75663393 What you're trying to do is not possible. See the links on weak linking for how to deal with missing symbols. – Rob Napier Mar 08 '23 at 14:22

0 Answers0