When to use FOUNDATION_EXPORT?

后端 未结 2 869
故里飘歌
故里飘歌 2021-02-14 02:31

I am a bit confused as when we should use FOUNDATION_EXPORT in objective-c and what the purpose of that is? Can anyone explain in layman terms? Thanks!

相关标签:
2条回答
  • 2021-02-14 03:11

    When to use FOUNDATION_EXPORT?

    Never.

    FOUNDATION_EXPORT is an undocumented implementation detail of Apple's system frameworks so you should not use it at all.

    0 讨论(0)
  • 2021-02-14 03:23

    When we should use FOUNDATION_EXPORT in Objective-c

    Whenever you are importing foundation framework in Objective-C. It is the best practice to use FOUNDATION_EXPORT instead of extern. Because NSObjCRuntime.h in Foundation framework it includes c and c++ library. So for default visibility of the c and c++ symbols it compiles accordingly for making it more compatible.

    Purpose of using FOUNDATION_EXPORT instead of extern:

    1) Visible Symbolity

    2) Compatibility to other source code.

    0 讨论(0)
提交回复
热议问题