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!
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With