this repo has no description
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#import <Foundation/Foundation.h>
9
10#import "RCTModuleProviders.h"
11#import <ReactCommon/RCTTurboModule.h>
12#import <React/RCTLog.h>
13
14@implementation RCTModuleProviders
15
16+ (NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders
17{
18 static NSDictionary<NSString *, id<RCTModuleProvider>> *providers = nil;
19 static dispatch_once_t onceToken;
20
21 dispatch_once(&onceToken, ^{
22 NSDictionary<NSString *, NSString *> * moduleMapping = @{
23
24 };
25
26 NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:moduleMapping.count];
27
28 for (NSString *key in moduleMapping) {
29 NSString * moduleProviderName = moduleMapping[key];
30 Class klass = NSClassFromString(moduleProviderName);
31 if (!klass) {
32 RCTLogError(@"Module provider %@ cannot be found in the runtime", moduleProviderName);
33 continue;
34 }
35
36 id instance = [klass new];
37 if (![instance respondsToSelector:@selector(getTurboModule:)]) {
38 RCTLogError(@"Module provider %@ does not conform to RCTModuleProvider", moduleProviderName);
39 continue;
40 }
41
42 [dict setObject:instance forKey:key];
43 }
44
45 providers = dict;
46 });
47
48 return providers;
49}
50
51@end