2

I've found that there is a UIKIT_DEFINE_AS_PROPERTIES macro in a lot of places in system's headers like this:

#if UIKIT_DEFINE_AS_PROPERTIES
@property(class, nonatomic, readonly) UIDevice *currentDevice;
#else
+ (UIDevice *)currentDevice;
#endif

But I cannot find the value of it.

what's the use for UIKIT_DEFINE_AS_PROPERTIES and where is it defined?

It is for swift?

Gon
  • 1,135
  • 12
  • 22

1 Answers1

1

UIKIT_DEFINE_AS_PROPERTIES is defined in <UIKit/UIKitDefines.h> as

#if (!defined(SWIFT_CLASS_EXTRA) || (defined(SWIFT_SDK_OVERLAY_UIKIT_EPOCH) && SWIFT_SDK_OVERLAY_UIKIT_EPOCH >= 1))
    #define UIKIT_DEFINE_AS_PROPERTIES 1
#else
    #define UIKIT_DEFINE_AS_PROPERTIES 0
#endif

The SWIFT_CLASS_EXTRA and SWIFT_SDK_OVERLAY_UIKIT_EPOCH macros control how Objective-C code is imported into Swift, compare ClangImporter.cpp.

Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382