expo-modules-core 0.6.5 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (219) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +1 -1
  3. package/android/ExpoModulesCorePlugin.gradle +15 -0
  4. package/android/build.gradle +31 -15
  5. package/android/src/main/java/expo/modules/adapters/react/NativeModulesProxy.java +5 -5
  6. package/android/src/main/java/expo/modules/adapters/react/services/UIManagerModuleWrapper.java +13 -0
  7. package/android/src/main/java/expo/modules/core/ViewManager.java +9 -0
  8. package/android/src/main/java/expo/modules/core/interfaces/JavaScriptContextProvider.java +4 -0
  9. package/android/src/main/java/expo/modules/core/interfaces/ReactActivityHandler.java +37 -1
  10. package/android/src/main/java/expo/modules/core/interfaces/ReactNativeHostHandler.java +30 -0
  11. package/android/src/main/java/expo/modules/core/interfaces/services/UIManager.java +2 -0
  12. package/android/src/main/java/expo/modules/kotlin/AppContext.kt +23 -5
  13. package/android/src/main/java/expo/modules/kotlin/DynamicExtenstions.kt +5 -3
  14. package/android/src/main/java/expo/modules/kotlin/KPromiseWrapper.kt +3 -8
  15. package/android/src/main/java/expo/modules/kotlin/KotlinInteropModuleRegistry.kt +24 -9
  16. package/android/src/main/java/expo/modules/kotlin/ModuleHolder.kt +12 -7
  17. package/android/src/main/java/expo/modules/kotlin/ModuleRegistry.kt +23 -1
  18. package/android/src/main/java/expo/modules/kotlin/Promise.kt +1 -1
  19. package/android/src/main/java/expo/modules/kotlin/callbacks/Callback.kt +5 -0
  20. package/android/src/main/java/expo/modules/kotlin/callbacks/ViewCallback.kt +39 -0
  21. package/android/src/main/java/expo/modules/kotlin/callbacks/ViewCallbackDelegate.kt +27 -0
  22. package/android/src/main/java/expo/modules/kotlin/defaultmodules/ErrorManagerModule.kt +25 -0
  23. package/android/src/main/java/expo/modules/kotlin/events/EventEmitter.kt +13 -0
  24. package/android/src/main/java/expo/modules/kotlin/events/KModuleEventEmitterWrapper.kt +102 -0
  25. package/android/src/main/java/expo/modules/kotlin/exception/CodedException.kt +93 -9
  26. package/android/src/main/java/expo/modules/kotlin/exception/ExceptionDecorator.kt +11 -0
  27. package/android/src/main/java/expo/modules/kotlin/{methods/AnyMethod.kt → functions/AnyFunction.kt} +18 -18
  28. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunction.kt +15 -0
  29. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionBuilder.kt +170 -0
  30. package/android/src/main/java/expo/modules/kotlin/functions/AsyncFunctionWithPromise.kt +15 -0
  31. package/android/src/main/java/expo/modules/kotlin/functions/AsyncSuspendFunction.kt +36 -0
  32. package/android/src/main/java/expo/modules/kotlin/modules/DefinitionMarker.kt +4 -0
  33. package/android/src/main/java/expo/modules/kotlin/modules/Module.kt +17 -2
  34. package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionBuilder.kt +416 -43
  35. package/android/src/main/java/expo/modules/kotlin/modules/ModuleDefinitionData.kt +2 -2
  36. package/android/src/main/java/expo/modules/kotlin/records/FieldValidator.kt +139 -0
  37. package/android/src/main/java/expo/modules/kotlin/records/RecordTypeConverter.kt +71 -15
  38. package/android/src/main/java/expo/modules/kotlin/records/Required.kt +5 -0
  39. package/android/src/main/java/expo/modules/kotlin/records/ValidationBinder.kt +110 -0
  40. package/android/src/main/java/expo/modules/kotlin/records/Validators.kt +61 -0
  41. package/android/src/main/java/expo/modules/kotlin/types/ArrayTypeConverter.kt +11 -5
  42. package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverter.kt +35 -0
  43. package/android/src/main/java/expo/modules/kotlin/types/JSTypeConverterHelper.kt +148 -0
  44. package/android/src/main/java/expo/modules/kotlin/types/ListTypeConverter.kt +10 -4
  45. package/android/src/main/java/expo/modules/kotlin/types/MapTypeConverter.kt +12 -6
  46. package/android/src/main/java/expo/modules/kotlin/types/PairTypeConverter.kt +29 -13
  47. package/android/src/main/java/expo/modules/kotlin/types/TypeConverter.kt +2 -1
  48. package/android/src/main/java/expo/modules/kotlin/types/TypeConverterProvider.kt +9 -1
  49. package/android/src/main/java/expo/modules/kotlin/views/CallbacksDefinition.kt +3 -0
  50. package/android/src/main/java/expo/modules/kotlin/views/GroupViewManagerWrapper.kt +71 -0
  51. package/android/src/main/java/expo/modules/kotlin/views/SimpleViewManagerWrapper.kt +22 -0
  52. package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinition.kt +18 -0
  53. package/android/src/main/java/expo/modules/kotlin/views/ViewGroupDefinitionBuilder.kt +114 -0
  54. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinition.kt +30 -2
  55. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerDefinitionBuilder.kt +81 -2
  56. package/android/src/main/java/expo/modules/kotlin/views/ViewManagerWrapperDelegate.kt +62 -2
  57. package/build/EventEmitter.d.ts +1 -0
  58. package/build/EventEmitter.d.ts.map +1 -0
  59. package/build/NativeModulesProxy.d.ts +1 -0
  60. package/build/NativeModulesProxy.d.ts.map +1 -0
  61. package/build/NativeModulesProxy.native.d.ts +1 -4
  62. package/build/NativeModulesProxy.native.d.ts.map +1 -0
  63. package/build/NativeModulesProxy.native.js +1 -14
  64. package/build/NativeModulesProxy.native.js.map +1 -1
  65. package/build/NativeModulesProxy.types.d.ts +1 -3
  66. package/build/NativeModulesProxy.types.d.ts.map +1 -0
  67. package/build/NativeModulesProxy.types.js.map +1 -1
  68. package/build/NativeViewManagerAdapter.d.ts +1 -0
  69. package/build/NativeViewManagerAdapter.d.ts.map +1 -0
  70. package/build/NativeViewManagerAdapter.native.d.ts +1 -0
  71. package/build/NativeViewManagerAdapter.native.d.ts.map +1 -0
  72. package/build/NativeViewManagerAdapter.native.js +9 -33
  73. package/build/NativeViewManagerAdapter.native.js.map +1 -1
  74. package/build/PermissionsHook.d.ts +1 -0
  75. package/build/PermissionsHook.d.ts.map +1 -0
  76. package/build/PermissionsInterface.d.ts +1 -0
  77. package/build/PermissionsInterface.d.ts.map +1 -0
  78. package/build/Platform.d.ts +1 -0
  79. package/build/Platform.d.ts.map +1 -0
  80. package/build/SyntheticPlatformEmitter.d.ts +1 -0
  81. package/build/SyntheticPlatformEmitter.d.ts.map +1 -0
  82. package/build/SyntheticPlatformEmitter.web.d.ts +1 -0
  83. package/build/SyntheticPlatformEmitter.web.d.ts.map +1 -0
  84. package/build/deprecate.d.ts +1 -0
  85. package/build/deprecate.d.ts.map +1 -0
  86. package/build/environment/browser.d.ts +1 -0
  87. package/build/environment/browser.d.ts.map +1 -0
  88. package/build/environment/browser.web.d.ts +1 -0
  89. package/build/environment/browser.web.d.ts.map +1 -0
  90. package/build/errors/CodedError.d.ts +1 -0
  91. package/build/errors/CodedError.d.ts.map +1 -0
  92. package/build/errors/UnavailabilityError.d.ts +1 -0
  93. package/build/errors/UnavailabilityError.d.ts.map +1 -0
  94. package/build/index.d.ts +3 -0
  95. package/build/index.d.ts.map +1 -0
  96. package/build/index.js +2 -0
  97. package/build/index.js.map +1 -1
  98. package/build/requireNativeModule.d.ts +16 -0
  99. package/build/requireNativeModule.d.ts.map +1 -0
  100. package/build/requireNativeModule.js +18 -0
  101. package/build/requireNativeModule.js.map +1 -0
  102. package/build/sweet/NativeErrorManager.d.ts +3 -0
  103. package/build/sweet/NativeErrorManager.d.ts.map +1 -0
  104. package/build/sweet/NativeErrorManager.js +3 -0
  105. package/build/sweet/NativeErrorManager.js.map +1 -0
  106. package/build/sweet/setUpErrorManager.fx.d.ts +2 -0
  107. package/build/sweet/setUpErrorManager.fx.d.ts.map +1 -0
  108. package/build/sweet/setUpErrorManager.fx.js +11 -0
  109. package/build/sweet/setUpErrorManager.fx.js.map +1 -0
  110. package/ios/AppDelegates/EXAppDelegatesLoader.m +4 -8
  111. package/ios/AppDelegates/ExpoAppDelegate.swift +22 -20
  112. package/ios/EXAppDefines.h +1 -0
  113. package/ios/EXAppDefines.m +6 -0
  114. package/ios/EXUtilities.h +2 -0
  115. package/ios/EXUtilities.m +12 -0
  116. package/ios/ExpoModulesCore.h +4 -0
  117. package/ios/ExpoModulesCore.podspec +4 -2
  118. package/ios/Interfaces/FileSystem/EXFileSystemInterface.h +1 -1
  119. package/ios/Interfaces/TaskManager/EXTaskServiceInterface.h +1 -0
  120. package/ios/JSI/{JSIConversions.h → EXJSIConversions.h} +5 -0
  121. package/ios/JSI/{JSIConversions.mm → EXJSIConversions.mm} +21 -1
  122. package/ios/JSI/{JSIInstaller.h → EXJSIInstaller.h} +10 -0
  123. package/ios/JSI/EXJSIInstaller.mm +17 -0
  124. package/ios/JSI/EXJSIUtils.h +19 -0
  125. package/ios/JSI/EXJSIUtils.mm +89 -0
  126. package/ios/JSI/EXJavaScriptObject.h +97 -0
  127. package/ios/JSI/EXJavaScriptObject.mm +121 -0
  128. package/ios/JSI/EXJavaScriptRuntime.h +73 -0
  129. package/ios/JSI/EXJavaScriptRuntime.mm +153 -0
  130. package/ios/JSI/EXJavaScriptValue.h +57 -0
  131. package/ios/JSI/EXJavaScriptValue.mm +166 -0
  132. package/ios/JSI/ExpoModulesHostObject.h +33 -0
  133. package/ios/JSI/ExpoModulesHostObject.mm +41 -0
  134. package/ios/JSI/JavaScriptRuntime.swift +32 -0
  135. package/ios/JSI/JavaScriptValue.swift +94 -0
  136. package/ios/ModuleRegistryAdapter/EXModuleRegistryAdapter.m +3 -23
  137. package/ios/NativeModulesProxy/EXNativeModulesProxy.h +2 -2
  138. package/ios/NativeModulesProxy/EXNativeModulesProxy.mm +101 -75
  139. package/ios/RCTComponentData+Privates.h +12 -0
  140. package/ios/ReactDelegates/EXReactCompatibleHelpers.h +18 -0
  141. package/ios/ReactDelegates/EXReactCompatibleHelpers.m +19 -0
  142. package/ios/ReactDelegates/ExpoReactDelegate.swift +3 -3
  143. package/ios/ReactDelegates/ExpoReactDelegateHandler.swift +4 -4
  144. package/ios/ReactDelegates/ModulePriorities.swift +1 -1
  145. package/ios/Swift/AppContext.swift +57 -4
  146. package/ios/Swift/Arguments/AnyArgumentType.swift +1 -1
  147. package/ios/Swift/Arguments/ArgumentType.swift +4 -0
  148. package/ios/Swift/Arguments/Convertibles.swift +13 -13
  149. package/ios/Swift/Arguments/Types/EnumArgumentType.swift +11 -17
  150. package/ios/Swift/Arguments/Types/PromiseArgumentType.swift +1 -1
  151. package/ios/Swift/Arguments/Types/RawArgumentType.swift +2 -2
  152. package/ios/Swift/Conversions.swift +51 -56
  153. package/ios/Swift/EventListener.swift +8 -10
  154. package/ios/Swift/Events/Callback.swift +66 -0
  155. package/ios/Swift/Events/Event.swift +43 -0
  156. package/ios/Swift/Exceptions/ChainableException.swift +51 -0
  157. package/ios/Swift/{CodedError.swift → Exceptions/CodedError.swift} +1 -12
  158. package/ios/Swift/Exceptions/Exception.swift +62 -0
  159. package/ios/Swift/Exceptions/ExceptionOrigin.swift +28 -0
  160. package/ios/Swift/Exceptions/GenericException.swift +20 -0
  161. package/ios/Swift/Exceptions/UnexpectedException.swift +16 -0
  162. package/ios/Swift/Functions/AnyFunction.swift +16 -1
  163. package/ios/Swift/Functions/AsyncFunctionComponent.swift +182 -0
  164. package/ios/Swift/Functions/ConcreteFunction.swift +52 -59
  165. package/ios/Swift/Functions/SyncFunctionComponent.swift +181 -0
  166. package/ios/Swift/JavaScriptUtils.swift +99 -0
  167. package/ios/Swift/ModuleHolder.swift +69 -18
  168. package/ios/Swift/ModuleRegistry.swift +4 -1
  169. package/ios/Swift/Modules/AnyModule.swift +0 -1
  170. package/ios/Swift/Modules/ModuleDefinition.swift +4 -13
  171. package/ios/Swift/Modules/ModuleDefinitionBuilder.swift +0 -1
  172. package/ios/Swift/Modules/ModuleDefinitionComponents.swift +54 -220
  173. package/ios/Swift/ModulesProvider.swift +3 -11
  174. package/ios/Swift/Objects/ObjectDefinition.swift +30 -0
  175. package/ios/Swift/Objects/ObjectDefinitionComponents.swift +257 -0
  176. package/ios/Swift/Promise.swift +8 -3
  177. package/ios/Swift/Records/AnyField.swift +7 -0
  178. package/ios/Swift/Records/Field.swift +24 -19
  179. package/ios/Swift/Records/FieldOption.swift +1 -1
  180. package/ios/Swift/Records/Record.swift +12 -4
  181. package/ios/Swift/SwiftInteropBridge.swift +53 -15
  182. package/ios/Swift/Views/AnyViewProp.swift +1 -1
  183. package/ios/Swift/Views/ComponentData.swift +96 -0
  184. package/ios/Swift/Views/ConcreteViewProp.swift +6 -8
  185. package/ios/Swift/Views/ExpoView.swift +8 -0
  186. package/ios/Swift/Views/ViewFactory.swift +1 -1
  187. package/ios/Swift/Views/ViewManagerDefinition.swift +23 -2
  188. package/ios/Swift/Views/ViewManagerDefinitionBuilder.swift +0 -1
  189. package/ios/Swift/Views/ViewManagerDefinitionComponents.swift +49 -0
  190. package/ios/Swift/Views/ViewModuleWrapper.swift +5 -2
  191. package/ios/Swift.h +5 -0
  192. package/ios/Tests/ArgumentTypeSpec.swift +5 -7
  193. package/ios/Tests/ConstantsSpec.swift +6 -7
  194. package/ios/Tests/ConvertiblesSpec.swift +35 -36
  195. package/ios/Tests/ExceptionsSpec.swift +111 -0
  196. package/ios/Tests/ExpoModulesSpec.swift +75 -0
  197. package/ios/Tests/FunctionSpec.swift +21 -25
  198. package/ios/Tests/FunctionWithConvertiblesSpec.swift +4 -5
  199. package/ios/Tests/JavaScriptObjectSpec.swift +97 -0
  200. package/ios/Tests/JavaScriptRuntimeSpec.swift +94 -0
  201. package/ios/Tests/Mocks/ModuleMocks.swift +1 -1
  202. package/ios/Tests/Mocks/ModulesProviderMock.swift +0 -1
  203. package/ios/Tests/ModuleEventListenersSpec.swift +16 -17
  204. package/ios/Tests/ModuleRegistrySpec.swift +2 -3
  205. package/ios/Tests/RecordSpec.swift +9 -20
  206. package/package.json +3 -3
  207. package/src/NativeModulesProxy.native.ts +2 -22
  208. package/src/NativeModulesProxy.types.ts +0 -8
  209. package/src/NativeViewManagerAdapter.native.tsx +12 -28
  210. package/src/index.ts +4 -0
  211. package/src/requireNativeModule.ts +29 -0
  212. package/src/sweet/NativeErrorManager.ts +2 -0
  213. package/src/sweet/setUpErrorManager.fx.ts +12 -0
  214. package/android/src/main/java/expo/modules/kotlin/events/KEventEmitterWrapper.kt +0 -26
  215. package/android/src/main/java/expo/modules/kotlin/methods/Method.kt +0 -14
  216. package/android/src/main/java/expo/modules/kotlin/methods/PromiseMethod.kt +0 -15
  217. package/ios/JSI/ExpoModulesProxySpec.h +0 -24
  218. package/ios/JSI/ExpoModulesProxySpec.mm +0 -135
  219. package/ios/JSI/JSIInstaller.mm +0 -22
@@ -13,7 +13,7 @@
13
13
 
14
14
  @property (nonatomic, strong) EXModuleRegistryProvider *moduleRegistryProvider;
15
15
  @property (nonatomic, strong) EXViewManagerAdapterClassesRegistry *viewManagersClassesRegistry;
16
- @property (nonatomic, strong, nullable) id<ModulesProviderObjCProtocol> swiftModulesProvider;
16
+ @property (nonatomic, strong, nullable) ModulesProvider *swiftModulesProvider;
17
17
 
18
18
  @end
19
19
 
@@ -28,16 +28,6 @@
28
28
  return self;
29
29
  }
30
30
 
31
- - (instancetype)initWithModuleRegistryProvider:(EXModuleRegistryProvider *)moduleRegistryProvider swiftModulesProviderClass:(nullable Class)swiftModulesProviderClass
32
- {
33
- if (self = [self initWithModuleRegistryProvider:moduleRegistryProvider]) {
34
- if ([swiftModulesProviderClass conformsToProtocol:@protocol(ModulesProviderObjCProtocol)]) {
35
- _swiftModulesProvider = [swiftModulesProviderClass new];
36
- }
37
- }
38
- return self;
39
- }
40
-
41
31
  - (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
42
32
  {
43
33
  return [self extraModulesForModuleRegistry:[_moduleRegistryProvider moduleRegistry]];
@@ -55,18 +45,9 @@
55
45
  EXReactNativeEventEmitter *eventEmitter = [EXReactNativeEventEmitter new];
56
46
  [moduleRegistry registerInternalModule:eventEmitter];
57
47
 
58
- NSMutableSet *exportedSwiftViewModuleNames = [NSMutableSet new];
59
-
60
- for (ViewModuleWrapper *swiftViewModule in [nativeModulesProxy.swiftInteropBridge getViewManagers]) {
61
- Class wrappedViewModuleClass = [ViewModuleWrapper createViewModuleWrapperClassWithModule:swiftViewModule];
62
- [extraModules addObject:[[wrappedViewModuleClass alloc] init]];
63
- [exportedSwiftViewModuleNames addObject:swiftViewModule.name];
64
- }
65
48
  for (EXViewManager *viewManager in [moduleRegistry getAllViewManagers]) {
66
- if (![exportedSwiftViewModuleNames containsObject:viewManager.viewName]) {
67
- Class viewManagerAdapterClass = [EXViewManagerAdapterClassesRegistry createViewManagerAdapterClassForViewManager:viewManager];
68
- [extraModules addObject:[[viewManagerAdapterClass alloc] init]];
69
- }
49
+ Class viewManagerAdapterClass = [EXViewManagerAdapterClassesRegistry createViewManagerAdapterClassForViewManager:viewManager];
50
+ [extraModules addObject:[[viewManagerAdapterClass alloc] init]];
70
51
  }
71
52
 
72
53
  // Silence React Native warning `Base module "%s" does not exist`
@@ -75,7 +56,6 @@
75
56
  // subclass EXViewManagerAdapter, so RN expects to find EXViewManagerAdapter
76
57
  // exported.
77
58
  [extraModules addObject:[[EXViewManagerAdapter alloc] init]];
78
- [extraModules addObject:[[ViewModuleWrapper alloc] initWithDummy:nil]];
79
59
 
80
60
  // It is possible that among internal modules there are some RCTBridgeModules --
81
61
  // let's add them to extraModules here.
@@ -12,7 +12,7 @@
12
12
  // Swift compatibility headers (e.g. `ExpoModulesCore-Swift.h`) are not available in headers,
13
13
  // so we use class forward declaration here. Swift header must be imported in the `.m` file.
14
14
  @class SwiftInteropBridge;
15
- @protocol ModulesProviderObjCProtocol;
15
+ @class ModulesProvider;
16
16
 
17
17
  NS_SWIFT_NAME(NativeModulesProxy)
18
18
  @interface EXNativeModulesProxy : NSObject <RCTBridgeModule>
@@ -25,6 +25,6 @@ NS_SWIFT_NAME(NativeModulesProxy)
25
25
  - (void)callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNameOrKey arguments:(NSArray *)arguments resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject;
26
26
  - (id)callMethodSync:(NSString *)moduleName methodName:(NSString *)methodName arguments:(NSArray *)arguments;
27
27
 
28
- + (id<ModulesProviderObjCProtocol>)getExpoModulesProvider;
28
+ + (ModulesProvider *)getExpoModulesProvider;
29
29
 
30
30
  @end
@@ -17,11 +17,11 @@
17
17
  #import <ExpoModulesCore/EXViewManagerAdapterClassesRegistry.h>
18
18
  #import <ExpoModulesCore/EXModuleRegistryProvider.h>
19
19
  #import <ExpoModulesCore/EXReactNativeEventEmitter.h>
20
- #import <ExpoModulesCore/JSIInstaller.h>
20
+ #import <ExpoModulesCore/EXJSIInstaller.h>
21
21
  #import <ExpoModulesCore/Swift.h>
22
22
 
23
23
  static const NSString *exportedMethodsNamesKeyPath = @"exportedMethods";
24
- static const NSString *viewManagersNamesKeyPath = @"viewManagersNames";
24
+ static const NSString *viewManagersMetadataKeyPath = @"viewManagersMetadata";
25
25
  static const NSString *exportedConstantsKeyPath = @"modulesConstants";
26
26
 
27
27
  static const NSString *methodInfoKeyKey = @"key";
@@ -41,13 +41,6 @@ static const NSString *methodInfoArgumentsCountKey = @"argumentsCount";
41
41
 
42
42
  @end
43
43
 
44
- @interface RCTComponentData (EXNativeModulesProxy)
45
-
46
- - (instancetype)initWithManagerClass:(Class)managerClass bridge:(RCTBridge *)bridge eventDispatcher:(id<RCTEventDispatcherProtocol>) eventDispatcher; // available in RN 0.65+
47
- - (instancetype)initWithManagerClass:(Class)managerClass bridge:(RCTBridge *)bridge;
48
-
49
- @end
50
-
51
44
  @interface EXNativeModulesProxy ()
52
45
 
53
46
  @property (nonatomic, strong) NSRegularExpression *regexp;
@@ -97,8 +90,9 @@ RCT_EXPORT_MODULE(NativeUnimoduleProxy)
97
90
 
98
91
  - (NSDictionary *)constantsToExport
99
92
  {
100
- // Install the TurboModule implementation of the proxy.
101
- [self installExpoTurboModules];
93
+ // Install ExpoModules host object in the runtime. It's probably not the right place,
94
+ // but it's the earliest moment in bridge's lifecycle when we have access to the runtime.
95
+ [self installExpoModulesHostObject];
102
96
 
103
97
  NSMutableDictionary <NSString *, id> *exportedModulesConstants = [NSMutableDictionary dictionary];
104
98
  // Grab all the constants exported by modules
@@ -130,17 +124,21 @@ RCT_EXPORT_MODULE(NativeUnimoduleProxy)
130
124
  // Add entries from Swift modules
131
125
  [exportedMethodsNamesAccumulator addEntriesFromDictionary:[_swiftInteropBridge exportedFunctionNames]];
132
126
 
133
- // Also, add `viewManagersNames` for sanity check and testing purposes -- with names we know what managers to mock on UIManager
127
+ // Also, add `viewManagersMetadata` for sanity check and testing purposes -- with names we know what managers to mock on UIManager
134
128
  NSArray<EXViewManager *> *viewManagers = [_exModuleRegistry getAllViewManagers];
135
- NSMutableArray<NSString *> *viewManagersNames = [NSMutableArray arrayWithCapacity:[viewManagers count]];
129
+ NSMutableDictionary<NSString *, NSDictionary *> *viewManagersMetadata = [[NSMutableDictionary alloc] initWithCapacity:[viewManagers count]];
130
+
136
131
  for (EXViewManager *viewManager in viewManagers) {
137
- [viewManagersNames addObject:[viewManager viewName]];
132
+ viewManagersMetadata[viewManager.viewName] = @{
133
+ @"propsNames": [[viewManager getPropsNames] allKeys]
134
+ };
138
135
  }
139
136
 
140
- [viewManagersNames addObjectsFromArray:[_swiftInteropBridge exportedViewManagersNames]];
137
+ // Add entries from Swift view managers
138
+ [viewManagersMetadata addEntriesFromDictionary:[_swiftInteropBridge viewManagersMetadata]];
141
139
 
142
140
  NSMutableDictionary <NSString *, id> *constantsAccumulator = [NSMutableDictionary dictionary];
143
- constantsAccumulator[viewManagersNamesKeyPath] = viewManagersNames;
141
+ constantsAccumulator[viewManagersMetadataKeyPath] = viewManagersMetadata;
144
142
  constantsAccumulator[exportedConstantsKeyPath] = exportedModulesConstants;
145
143
  constantsAccumulator[exportedMethodsNamesKeyPath] = exportedMethodsNamesAccumulator;
146
144
 
@@ -150,8 +148,18 @@ RCT_EXPORT_MODULE(NativeUnimoduleProxy)
150
148
  - (void)setBridge:(RCTBridge *)bridge
151
149
  {
152
150
  if (!_bridge) {
153
- [self registerExpoModulesInBridge:bridge];
151
+ // The `setBridge` can be called during module setup or after. Registering more modules
152
+ // during setup causes a crash due to mutating `_moduleDataByID` while it's being enumerated.
153
+ // In that case we register them asynchronously.
154
+ if ([[bridge valueForKey:@"_moduleSetupComplete"] boolValue]) {
155
+ [self registerExpoModulesInBridge:bridge];
156
+ } else {
157
+ dispatch_async(dispatch_get_main_queue(), ^{
158
+ [self registerExpoModulesInBridge:bridge];
159
+ });
160
+ }
154
161
  }
162
+ [_swiftInteropBridge setReactBridge:bridge];
155
163
  _bridge = bridge;
156
164
  }
157
165
 
@@ -203,7 +211,7 @@ RCT_EXPORT_METHOD(callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNa
203
211
 
204
212
  #pragma mark - Statics
205
213
 
206
- + (id<ModulesProviderObjCProtocol>)getExpoModulesProvider
214
+ + (ModulesProvider *)getExpoModulesProvider
207
215
  {
208
216
  // Dynamically gets the modules provider class.
209
217
  // NOTE: This needs to be versioned in Expo Go.
@@ -233,45 +241,49 @@ RCT_EXPORT_METHOD(callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNa
233
241
 
234
242
  - (void)registerExpoModulesInBridge:(RCTBridge *)bridge
235
243
  {
236
- // Registering expo modules in bridge is needed only when the proxy module owns the registry
237
- // (was autoinitialized by React Native). Otherwise they're registered by the registry adapter.
238
- if (!_ownsModuleRegistry || [bridge moduleIsInitialized:[EXReactNativeEventEmitter class]]) {
239
- return;
240
- }
244
+ // Registering expo modules (excluding Swifty view managers!) in bridge is needed only when the proxy module owns
245
+ // the registry (was autoinitialized by React Native). Otherwise they're registered by the registry adapter.
246
+ BOOL ownsModuleRegistry = _ownsModuleRegistry && ![bridge moduleIsInitialized:[EXReactNativeEventEmitter class]];
241
247
 
242
248
  // An array of `RCTBridgeModule` classes to register.
243
249
  NSMutableArray<Class<RCTBridgeModule>> *additionalModuleClasses = [NSMutableArray new];
244
250
  NSMutableSet *visitedSweetModules = [NSMutableSet new];
245
251
 
246
- // Event emitter is a bridge module, however it's also needed by expo modules,
247
- // so later we'll register an instance created by React Native as expo module.
248
- [additionalModuleClasses addObject:[EXReactNativeEventEmitter class]];
249
-
250
252
  // Add dynamic wrappers for view modules written in Sweet API.
251
253
  for (ViewModuleWrapper *swiftViewModule in [_swiftInteropBridge getViewManagers]) {
252
- Class wrappedViewModuleClass = [ViewModuleWrapper createViewModuleWrapperClassWithModule:swiftViewModule];
254
+ Class wrappedViewModuleClass = [self registerComponentData:swiftViewModule inBridge:bridge];
253
255
  [additionalModuleClasses addObject:wrappedViewModuleClass];
254
256
  [visitedSweetModules addObject:swiftViewModule.name];
255
257
  }
256
258
 
257
- // Add dynamic wrappers for the classic view managers.
258
- for (EXViewManager *viewManager in [_exModuleRegistry getAllViewManagers]) {
259
- if (![visitedSweetModules containsObject:viewManager.viewName]) {
260
- Class viewManagerWrapperClass = [EXViewManagerAdapterClassesRegistry createViewManagerAdapterClassForViewManager:viewManager];
261
- [additionalModuleClasses addObject:viewManagerWrapperClass];
259
+ [additionalModuleClasses addObject:[ViewModuleWrapper class]];
260
+ [self registerLegacyComponentData:[ViewModuleWrapper class] inBridge:bridge];
261
+
262
+ // Add modules from legacy module registry only when the NativeModulesProxy owns the registry.
263
+ if (ownsModuleRegistry) {
264
+ // Event emitter is a bridge module, however it's also needed by expo modules,
265
+ // so later we'll register an instance created by React Native as expo module.
266
+ [additionalModuleClasses addObject:[EXReactNativeEventEmitter class]];
267
+
268
+ // Add dynamic wrappers for the classic view managers.
269
+ for (EXViewManager *viewManager in [_exModuleRegistry getAllViewManagers]) {
270
+ if (![visitedSweetModules containsObject:viewManager.viewName]) {
271
+ Class viewManagerWrapperClass = [EXViewManagerAdapterClassesRegistry createViewManagerAdapterClassForViewManager:viewManager];
272
+ [additionalModuleClasses addObject:viewManagerWrapperClass];
273
+ [self registerLegacyComponentData:viewManagerWrapperClass inBridge:bridge];
274
+ }
262
275
  }
263
- }
264
276
 
265
- // View manager wrappers don't have their own prop configs, so we must register
266
- // their base view managers that provides common props such as `proxiedProperties`.
267
- // Otherwise, React Native may treat these props as invalid in subclassing views.
268
- [additionalModuleClasses addObject:[EXViewManagerAdapter class]];
269
- [additionalModuleClasses addObject:[ViewModuleWrapper class]];
277
+ // View manager wrappers don't have their own prop configs, so we must register
278
+ // their base view managers that provides common props such as `proxiedProperties`.
279
+ // Otherwise, React Native may treat these props as invalid in subclassing views.
280
+ [additionalModuleClasses addObject:[EXViewManagerAdapter class]];
270
281
 
271
- // Some modules might need access to the bridge.
272
- for (id module in [_exModuleRegistry getAllInternalModules]) {
273
- if ([module conformsToProtocol:@protocol(RCTBridgeModule)]) {
274
- [module setValue:bridge forKey:@"bridge"];
282
+ // Some modules might need access to the bridge.
283
+ for (id module in [_exModuleRegistry getAllInternalModules]) {
284
+ if ([module conformsToProtocol:@protocol(RCTBridgeModule)]) {
285
+ [module setValue:bridge forKey:@"bridge"];
286
+ }
275
287
  }
276
288
  }
277
289
 
@@ -283,19 +295,19 @@ RCT_EXPORT_METHOD(callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNa
283
295
  // Register the view managers as additional modules.
284
296
  [self registerAdditionalModuleClasses:additionalModuleClasses inBridge:bridge];
285
297
 
286
- // Bridge's `registerAdditionalModuleClasses:` method doesn't register
287
- // components in UIManager — we need to register them on our own.
288
- [self registerComponentDataForModuleClasses:additionalModuleClasses inBridge:bridge];
289
-
290
- // Get the newly created instance of `EXReactEventEmitter` bridge module,
291
- // pass event names supported by Swift modules and register it in legacy modules registry.
298
+ // Get the instance of `EXReactEventEmitter` bridge module and give it access to the interop bridge.
292
299
  EXReactNativeEventEmitter *eventEmitter = [bridge moduleForClass:[EXReactNativeEventEmitter class]];
293
300
  [eventEmitter setSwiftInteropBridge:_swiftInteropBridge];
294
- [_exModuleRegistry registerInternalModule:eventEmitter];
295
301
 
296
- // Let the modules consume the registry :)
297
- // It calls `setModuleRegistry:` on all `EXModuleRegistryConsumer`s.
298
- [_exModuleRegistry initialize];
302
+ // As the last step, when the registry is owned,
303
+ // register the event emitter and initialize the registry.
304
+ if (ownsModuleRegistry) {
305
+ [_exModuleRegistry registerInternalModule:eventEmitter];
306
+
307
+ // Let the modules consume the registry :)
308
+ // It calls `setModuleRegistry:` on all `EXModuleRegistryConsumer`s.
309
+ [_exModuleRegistry initialize];
310
+ }
299
311
  }
300
312
 
301
313
  - (void)registerAdditionalModuleClasses:(NSArray<Class> *)moduleClasses inBridge:(RCTBridge *)bridge
@@ -324,27 +336,38 @@ RCT_EXPORT_METHOD(callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNa
324
336
  [bridge registerAdditionalModuleClasses:moduleClasses];
325
337
  }
326
338
 
327
- - (void)registerComponentDataForModuleClasses:(NSArray<Class> *)moduleClasses inBridge:(RCTBridge *)bridge
339
+ - (Class)registerComponentData:(ViewModuleWrapper *)viewModule inBridge:(RCTBridge *)bridge
328
340
  {
329
341
  // Hacky way to get a dictionary with `RCTComponentData` from UIManager.
330
342
  NSMutableDictionary<NSString *, RCTComponentData *> *componentDataByName = [bridge.uiManager valueForKey:@"_componentDataByName"];
343
+ Class wrappedViewModuleClass = [ViewModuleWrapper createViewModuleWrapperClassWithModule:viewModule];
344
+ NSString *className = NSStringFromClass(wrappedViewModuleClass);
331
345
 
332
- // Register missing components data for all view managers.
333
- for (Class moduleClass in moduleClasses) {
334
- NSString *className = NSStringFromClass(moduleClass);
335
-
336
- if ([moduleClass isSubclassOfClass:[RCTViewManager class]] && !componentDataByName[className]) {
337
- RCTComponentData *componentData = [RCTComponentData alloc];
338
- if ([componentData respondsToSelector:@selector(initWithManagerClass:bridge:eventDispatcher:)]) {
339
- // Init method was changed in RN 0.65
340
- [componentData initWithManagerClass:moduleClass bridge:bridge eventDispatcher:bridge.eventDispatcher];
341
- } else {
342
- // fallback for older RNs
343
- [componentData initWithManagerClass:moduleClass bridge:bridge];
344
- }
345
-
346
- componentDataByName[className] = componentData;
347
- }
346
+ if (componentDataByName[className]) {
347
+ // Just in case the component was already registered, let's leave a log that we're overriding it.
348
+ NSLog(@"Overriding ComponentData for view %@", className);
349
+ }
350
+
351
+ EXComponentData *componentData = [[EXComponentData alloc] initWithViewModule:viewModule
352
+ managerClass:wrappedViewModuleClass
353
+ bridge:bridge];
354
+ componentDataByName[className] = componentData;
355
+ return wrappedViewModuleClass;
356
+ }
357
+
358
+ /**
359
+ Bridge's `registerAdditionalModuleClasses:` method doesn't register
360
+ components in UIManager — we need to register them on our own.
361
+ */
362
+ - (void)registerLegacyComponentData:(Class)moduleClass inBridge:(RCTBridge *)bridge
363
+ {
364
+ // Hacky way to get a dictionary with `RCTComponentData` from UIManager.
365
+ NSMutableDictionary<NSString *, RCTComponentData *> *componentDataByName = [bridge.uiManager valueForKey:@"_componentDataByName"];
366
+ NSString *className = NSStringFromClass(moduleClass);
367
+
368
+ if ([moduleClass isSubclassOfClass:[RCTViewManager class]] && !componentDataByName[className]) {
369
+ RCTComponentData *componentData = [[RCTComponentData alloc] initWithManagerClass:moduleClass bridge:bridge eventDispatcher:bridge.eventDispatcher];
370
+ componentDataByName[className] = componentData;
348
371
  }
349
372
  }
350
373
 
@@ -380,14 +403,17 @@ RCT_EXPORT_METHOD(callMethod:(NSString *)moduleName methodNameOrKey:(id)methodNa
380
403
  }
381
404
 
382
405
  /**
383
- Installs expo modules in JSI runtime.
406
+ Installs ExpoModules host object in the runtime that the current bridge operates on.
384
407
  */
385
- - (void)installExpoTurboModules
408
+ - (void)installExpoModulesHostObject
386
409
  {
387
- facebook::jsi::Runtime *runtime = [_bridge respondsToSelector:@selector(runtime)] ? reinterpret_cast<facebook::jsi::Runtime *>(_bridge.runtime) : NULL;
410
+ facebook::jsi::Runtime *jsiRuntime = [_bridge respondsToSelector:@selector(runtime)] ? reinterpret_cast<facebook::jsi::Runtime *>(_bridge.runtime) : nullptr;
411
+
412
+ if (jsiRuntime) {
413
+ EXJavaScriptRuntime *runtime = [[EXJavaScriptRuntime alloc] initWithRuntime:jsiRuntime callInvoker:_bridge.jsCallInvoker];
388
414
 
389
- if (runtime) {
390
- expo::installRuntimeObjects(*runtime, _bridge.jsCallInvoker, self);
415
+ [EXJavaScriptRuntimeManager installExpoModulesToRuntime:runtime withSwiftInterop:_swiftInteropBridge];
416
+ [_swiftInteropBridge setRuntime:runtime];
391
417
  }
392
418
  }
393
419
 
@@ -0,0 +1,12 @@
1
+ // Copyright 2021-present 650 Industries. All rights reserved.
2
+
3
+ #import <React/RCTComponent.h>
4
+ #import <React/RCTComponentData.h>
5
+
6
+ typedef void (^RCTPropBlockAlias)(id<RCTComponent> _Nonnull view, id _Nullable json);
7
+
8
+ @interface RCTComponentData (Privates)
9
+
10
+ - (nonnull RCTPropBlockAlias)createPropBlock:(nonnull NSString *)name isShadowView:(BOOL)isShadowView;
11
+
12
+ @end
@@ -0,0 +1,18 @@
1
+ // Copyright 2018-present 650 Industries. All rights reserved.
2
+
3
+ #import <UIKit/UIKit.h>
4
+
5
+ #import <ExpoModulesCore/EXDefines.h>
6
+ #import <React/RCTBridge.h>
7
+
8
+
9
+ EX_EXTERN_C_BEGIN
10
+
11
+ /**
12
+ * Backward compatible version of `RCTAppSetupDefaultRootView`.
13
+ *
14
+ * `RCTAppSetupDefaultRootView` is introduced in react-native 0.68. To make `expo-modules-core` compatible with older react-native, introduces this compatible helper.
15
+ */
16
+ UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties);
17
+
18
+ EX_EXTERN_C_END
@@ -0,0 +1,19 @@
1
+ // Copyright 2018-present 650 Industries. All rights reserved.
2
+
3
+ #import <ExpoModulesCore/EXReactCompatibleHelpers.h>
4
+
5
+ #import <React/RCTRootView.h>
6
+
7
+ #if __has_include(<React/RCTAppSetupUtils.h>)
8
+ #import <React/RCTAppSetupUtils.h>
9
+ #endif
10
+
11
+ UIView *EXAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties)
12
+ {
13
+ #if __has_include(<React/RCTAppSetupUtils.h>)
14
+ return RCTAppSetupDefaultRootView(bridge, moduleName, initialProperties);
15
+ #else
16
+ return [[RCTRootView alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties];
17
+ #endif
18
+ }
19
+
@@ -12,7 +12,7 @@ public class ExpoReactDelegate: NSObject {
12
12
  }
13
13
 
14
14
  @objc
15
- public func createBridge(delegate: RCTBridgeDelegate, launchOptions: [AnyHashable : Any]?) -> RCTBridge {
15
+ public func createBridge(delegate: RCTBridgeDelegate, launchOptions: [AnyHashable: Any]?) -> RCTBridge {
16
16
  self.handlers.forEach { $0.bridgeWillCreate() }
17
17
  let result = self.handlers.lazy
18
18
  .compactMap { $0.createBridge(reactDelegate: self, bridgeDelegate: delegate, launchOptions: launchOptions) }
@@ -22,10 +22,10 @@ public class ExpoReactDelegate: NSObject {
22
22
  }
23
23
 
24
24
  @objc
25
- public func createRootView(bridge: RCTBridge, moduleName: String, initialProperties: [AnyHashable : Any]?) -> RCTRootView {
25
+ public func createRootView(bridge: RCTBridge, moduleName: String, initialProperties: [AnyHashable: Any]?) -> UIView {
26
26
  return self.handlers.lazy
27
27
  .compactMap { $0.createRootView(reactDelegate: self, bridge: bridge, moduleName: moduleName, initialProperties: initialProperties) }
28
- .first(where: { _ in true }) ?? RCTRootView(bridge: bridge, moduleName: moduleName, initialProperties: initialProperties)
28
+ .first(where: { _ in true }) ?? EXAppSetupDefaultRootView(bridge, moduleName, initialProperties)
29
29
  }
30
30
 
31
31
  @objc
@@ -1,6 +1,6 @@
1
1
  // Copyright 2018-present 650 Industries. All rights reserved.
2
2
 
3
- import Foundation
3
+ import React
4
4
 
5
5
  /**
6
6
  The handler for `ExpoReactDelegate`. A module can implement a handler to process react instance creation.
@@ -14,7 +14,7 @@ open class ExpoReactDelegateHandler: NSObject {
14
14
  Otherwise return nil.
15
15
  */
16
16
  @objc
17
- open func createBridge(reactDelegate: ExpoReactDelegate, bridgeDelegate: RCTBridgeDelegate, launchOptions: [AnyHashable : Any]?) -> RCTBridge? {
17
+ open func createBridge(reactDelegate: ExpoReactDelegate, bridgeDelegate: RCTBridgeDelegate, launchOptions: [AnyHashable: Any]?) -> RCTBridge? {
18
18
  return nil
19
19
  }
20
20
 
@@ -23,7 +23,7 @@ open class ExpoReactDelegateHandler: NSObject {
23
23
  Otherwise return nil.
24
24
  */
25
25
  @objc
26
- open func createRootView(reactDelegate: ExpoReactDelegate, bridge: RCTBridge, moduleName: String, initialProperties: [AnyHashable : Any]?) -> RCTRootView? {
26
+ open func createRootView(reactDelegate: ExpoReactDelegate, bridge: RCTBridge, moduleName: String, initialProperties: [AnyHashable: Any]?) -> RCTRootView? {
27
27
  return nil
28
28
  }
29
29
 
@@ -36,7 +36,7 @@ open class ExpoReactDelegateHandler: NSObject {
36
36
  return nil
37
37
  }
38
38
 
39
- // MARK - event callbacks
39
+ // MARK: - event callbacks
40
40
 
41
41
  /**
42
42
  Callback before bridge creation
@@ -11,7 +11,7 @@ internal struct ModulePriorities {
11
11
  // key: node package name
12
12
  // value: priority value, the higher value takes precedence
13
13
  "expo-screen-orientation": 10,
14
- "expo-updates": 5,
14
+ "expo-updates": 5
15
15
  ]
16
16
 
17
17
  static func get(_ packageName: String) -> Int {
@@ -3,6 +3,13 @@ import UIKit
3
3
  The app context is an interface to a single Expo app.
4
4
  */
5
5
  public final class AppContext {
6
+ internal static func create() -> AppContext {
7
+ let appContext = AppContext()
8
+
9
+ appContext.runtime = JavaScriptRuntime()
10
+ return appContext
11
+ }
12
+
6
13
  /**
7
14
  The module registry for the app context.
8
15
  */
@@ -13,6 +20,25 @@ public final class AppContext {
13
20
  */
14
21
  public private(set) var legacyModuleRegistry: EXModuleRegistry?
15
22
 
23
+ /**
24
+ React bridge of the context's app.
25
+ */
26
+ public internal(set) weak var reactBridge: RCTBridge?
27
+
28
+ /**
29
+ JSI runtime of the running app.
30
+ */
31
+ public internal(set) var runtime: JavaScriptRuntime? {
32
+ didSet {
33
+ // When the runtime is unpinned from the context (e.g. deallocated),
34
+ // we should make sure to release all JS objects from the memory.
35
+ // Otherwise the JSCRuntime asserts may fail on deallocation.
36
+ if runtime == nil {
37
+ releaseRuntimeObjects()
38
+ }
39
+ }
40
+ }
41
+
16
42
  /**
17
43
  Designated initializer without modules provider.
18
44
  */
@@ -85,7 +111,7 @@ public final class AppContext {
85
111
  [
86
112
  UIApplication.willEnterForegroundNotification,
87
113
  UIApplication.didBecomeActiveNotification,
88
- UIApplication.didEnterBackgroundNotification,
114
+ UIApplication.didEnterBackgroundNotification
89
115
  ].forEach { name in
90
116
  NotificationCenter.default.addObserver(self, selector: #selector(handleClientAppNotification(_:)), name: name, object: nil)
91
117
  }
@@ -108,6 +134,25 @@ public final class AppContext {
108
134
  }
109
135
  }
110
136
 
137
+ // MARK: - Runtime
138
+
139
+ internal func installExpoModulesHostObject(_ interopBridge: SwiftInteropBridge) throws {
140
+ guard let runtime = runtime else {
141
+ throw UndefinedRuntimeException()
142
+ }
143
+ EXJavaScriptRuntimeManager.installExpoModules(to: runtime, withSwiftInterop: interopBridge)
144
+ }
145
+ /**
146
+ Unsets runtime objects that we hold for each module.
147
+ */
148
+ private func releaseRuntimeObjects() {
149
+ for module in moduleRegistry {
150
+ module.javaScriptObject = nil
151
+ }
152
+ }
153
+
154
+ // MARK: - Deallocation
155
+
111
156
  /**
112
157
  Cleans things up before deallocation.
113
158
  */
@@ -116,9 +161,17 @@ public final class AppContext {
116
161
  moduleRegistry.post(event: .appContextDestroys)
117
162
  }
118
163
 
119
- // MARK: Errors
164
+ // MARK: - Exceptions
165
+
166
+ class DeallocatedAppContextException: Exception {
167
+ override var reason: String {
168
+ "The AppContext has been deallocated"
169
+ }
170
+ }
120
171
 
121
- struct DeallocatedAppContextError: CodedError {
122
- var description: String = "The app context has been deallocated."
172
+ class UndefinedRuntimeException: Exception {
173
+ override var reason: String {
174
+ "The AppContext has undefined runtime"
175
+ }
123
176
  }
124
177
  }
@@ -4,7 +4,7 @@
4
4
  A protocol whose intention is to wrap function's argument type
5
5
  to keep its real signature and not type-erase it by the compiler.
6
6
  */
7
- internal protocol AnyArgumentType: CustomStringConvertible {
7
+ public protocol AnyArgumentType: CustomStringConvertible {
8
8
  /**
9
9
  Casts given any value to the wrapped type and returns as `Any`.
10
10
  NOTE: It may not be just simple type-casting (e.g. when the wrapped type conforms to `ConvertibleArgument`).
@@ -1,5 +1,9 @@
1
1
  // Copyright 2021-present 650 Industries. All rights reserved.
2
2
 
3
+ // Function names should start with a lowercase character, but in this one case
4
+ // we want it to be uppercase as we treat it more like a generic class.
5
+ // swiftlint:disable identifier_name
6
+
3
7
  /**
4
8
  Factory creating an instance of the argument type wrapper conforming to `AnyArgumentType`.
5
9
  Depending on the given type, it may return one of `ArrayArgumentType`, `OptionalArgumentType`, `ConvertibleArgumentType`, etc.