react-native-macos/React/Base
Alfred Zien ff66600224 Use constructor attribute instead of +load objc method (#24155)
Summary:
Xcode 10.2 forbids creating categories for swift class that uses `+load` method. In react-native categories like this are used to register swift classes as modules (macro `RCT_EXTERN_MODULE`) This PR changes it to use `__attribute__((constructor))` instead of objc `+load` method.

I introduced new macro for this purpose, `RCT_EXPORT_MODULE_NO_LOAD`, it expands in something like:
```
void RCTRegisterModule(Class);

+ (NSString *)moduleName {
  return @"jsNameFoo";
}

__attribute__((constructor)) static void initialize_ObjcClassFoo{
  RCTRegisterModule([ObjcClassFoo class]);
}
```

Functions marked with `__attribute__((constructor))` are run before main and after all `+load` methods, so it seems like correct thing to do.

Fixes https://github.com/facebook/react-native/issues/24139
Doc about loading order https://developer.apple.com/documentation/objectivec/nsobject/1418815-load?language=objc

[iOS] [Fixed] - Fix runtime crash in xcode 10.2 when using RCT_EXTERN_MODULE for swift classes.
Pull Request resolved: https://github.com/facebook/react-native/pull/24155

Reviewed By: javache

Differential Revision: D14668235

Pulled By: shergin

fbshipit-source-id: 0c19e69ce2a68327387809773848d4ecd36d7461
2019-03-31 22:40:59 -07:00
..
Surface Fix 50 xcode warnings (#23553) 2019-02-20 10:17:26 -08:00
RCTAssert.h Crash reporting heaven (#23691) 2019-03-12 19:41:51 -07:00
RCTAssert.m Crash reporting heaven (#23691) 2019-03-12 19:41:51 -07:00
RCTBridge+Private.h Remove compiler warning (#23588) 2019-02-22 01:40:09 -08:00
RCTBridge.h Introduce Module Setup Metric (#23859) 2019-03-22 10:43:00 -07:00
RCTBridge.m Introduce Module Setup Metric (#23859) 2019-03-22 10:43:00 -07:00
RCTBridgeDelegate.h iOS: register lazy nativemodules on startup when Chrome is attached 2018-11-02 00:16:16 -07:00
RCTBridgeMethod.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTBridgeModule.h Use constructor attribute instead of +load objc method (#24155) 2019-03-31 22:40:59 -07:00
RCTBundleURLProvider.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTBundleURLProvider.m Feature: dev menu option to change packager location during runtime (#21970) 2019-02-20 22:07:11 -08:00
RCTComponentEvent.h BREAKING - RCTEvent improvements, remove deprecated [sendInputEventWithName:body:] (#15894) 2019-03-27 11:20:22 -07:00
RCTComponentEvent.m BREAKING - RCTEvent improvements, remove deprecated [sendInputEventWithName:body:] (#15894) 2019-03-27 11:20:22 -07:00
RCTConvert.h Fix RNTester build 2018-09-17 12:33:01 -07:00
RCTConvert.m iOS support keyboardType ASCIICapableNumberPad (#20597) 2019-02-15 08:44:03 -08:00
RCTCxxConvert.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTCxxConvert.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTDefines.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTDisplayLink.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTDisplayLink.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTErrorCustomizer.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTErrorInfo.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTErrorInfo.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTEventDispatcher.h BREAKING - RCTEvent improvements, remove deprecated [sendInputEventWithName:body:] (#15894) 2019-03-27 11:20:22 -07:00
RCTEventDispatcher.m BREAKING - RCTEvent improvements, remove deprecated [sendInputEventWithName:body:] (#15894) 2019-03-27 11:20:22 -07:00
RCTFrameUpdate.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTFrameUpdate.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTImageSource.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTImageSource.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTInvalidating.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTJSStackFrame.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTJSStackFrame.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTJavaScriptExecutor.h iOS changes to switch to JSI 2018-10-18 01:06:24 -07:00
RCTJavaScriptLoader.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTJavaScriptLoader.mm iOS changes to switch to JSI 2018-10-18 01:06:24 -07:00
RCTKeyCommands.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTKeyCommands.m Remove compatible system code for iOS8 and before (#23656) 2019-02-26 07:58:52 -08:00
RCTLog.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTLog.mm Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTManagedPointer.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTManagedPointer.mm Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTModuleData.h Allow init of Native Module before bridge is initialized [2/N] 2018-11-26 17:28:11 -08:00
RCTModuleData.mm Properly validate JS->native method calls (#23658) 2019-03-04 17:39:53 -08:00
RCTModuleMethod.h Add support for argument conversion via RCTConvert 2019-03-22 16:23:40 -07:00
RCTModuleMethod.mm Add support for argument conversion via RCTConvert 2019-03-22 16:23:40 -07:00
RCTMultipartDataTask.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTMultipartDataTask.m Remove compatible system code for iOS8 and before (#23656) 2019-02-26 07:58:52 -08:00
RCTMultipartStreamReader.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTMultipartStreamReader.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTNullability.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTParserUtils.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTParserUtils.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTPerformanceLogger.h Introduce Module Setup Metric (#23859) 2019-03-22 10:43:00 -07:00
RCTPerformanceLogger.m Introduce Module Setup Metric (#23859) 2019-03-22 10:43:00 -07:00
RCTPlatform.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTPlatform.m Start using getConstants 2019-02-04 17:46:56 -08:00
RCTReloadCommand.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTReloadCommand.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRootContentView.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRootContentView.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRootView.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRootView.m No force layout of superview and contentSize recalculation if intrinsicContentSize not changed 2019-02-15 08:35:41 -08:00
RCTRootViewDelegate.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTRootViewInternal.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTVRemoteHandler.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTVRemoteHandler.m Differentiate swipe and tap events (#22916) 2019-01-15 16:29:38 -08:00
RCTTouchEvent.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTouchEvent.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTouchHandler.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTTouchHandler.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTURLRequestDelegate.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTURLRequestHandler.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTUtils.h Fix animation delay 2019-03-07 17:39:00 -08:00
RCTUtils.m Revert D14425373: [react-native][PR] [iOS] Remove explicitly add png file extension when load local image 2019-03-20 14:46:53 -07:00
RCTVersion.h Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00
RCTVersion.m Update copyright headers to yearless format 2018-09-11 15:33:07 -07:00