3

When i go to definition of classes in documentation, i always see these 2 things (UIKIT_EXTERN_CLASS and UIKIT_EXTERN) before the @interface, what these constants stand for and why Apple put it before their classes?

And one more thing, there is file UIKitDefines.h and it has all these definitions/constants.

#ifdef __cplusplus
#define UIKIT_EXTERN        extern "C" __attribute__((visibility ("default")))
#else
#define UIKIT_EXTERN            extern __attribute__((visibility ("default")))
#endif

#define UIKIT_STATIC_INLINE static inline
#define UIKIT_EXTERN_CLASS  __attribute__((visibility("default")))
itsaboutcode
  • 24,525
  • 45
  • 110
  • 156

1 Answers1

4

Take a look at this page from Apple's developer documentation. In essence, it appears those macros allow you to control the visibility of certain symbols to the rest of your application.

Matt Ball
  • 6,608
  • 1
  • 32
  • 31
  • Aha, the very last sentence sums it up: "if a given class is intended to be usable outside the library or executable it's defined in, you need to ensure proper symbol visibility." [that's for 64bit OS X and iPhone OS] – user123444555621 Jul 17 '10 at 19:51
  • The page referenced is now at [this link](https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/CppRuntimeEnv/Articles/SymbolVisibility.html) as Apple seem intent on breaking any old links. – Adrian B Sep 04 '19 at 11:33