@@ -4,17 +4,7 @@ @implementation <%- project.name -%>
4
4
5
5
RCT_EXPORT_MODULE ()
6
6
7
- <% if (project.arch === ' new' ) { -%>
8
- - (NSNumber *)multiply:(double )a b:(double )b {
9
- <% if (project.cpp ) { -%>
10
- NSNumber *result = @(<%- project.package_cpp -%>::multiply (a, b));
11
- <% } else { -%>
12
- NSNumber *result = @(a * b);
13
- <% } -%>
14
-
15
- return result;
16
- }
17
- <% } else { -%>
7
+ <% if (project.arch === ' legacy' || project.arch === ' mixed' ) { -%>
18
8
// Example method
19
9
// See // https://reactnative.dev/docs/native-modules-ios
20
10
RCT_REMAP_METHOD (multiply,
@@ -32,13 +22,33 @@ - (NSNumber *)multiply:(double)a b:(double)b {
32
22
}
33
23
<% } -%>
34
24
25
+ <% if (project.arch === ' new' || project.arch === ' mixed' ) { -%>
35
26
// Don't compile this code when we build for the old architecture.
36
27
#ifdef RCT_NEW_ARCH_ENABLED
28
+ <% if (project.arch === ' new' ) { -%>
29
+ - (NSNumber *)multiply:(double )a b:(double )b {
30
+ <% } else { -%>
31
+ - (void )multiply:(double )a b:(double )b resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject {
32
+ <% } -%>
33
+ <% if (project.cpp ) { -%>
34
+ NSNumber *result = @(<%- project.package_cpp -%>::multiply (a, b));
35
+ <% } else { -%>
36
+ NSNumber *result = @(a * b);
37
+ <% } -%>
38
+
39
+ <% if (project.arch === ' new' ) { -%>
40
+ return result;
41
+ <% } else { -%>
42
+ resolve (result);
43
+ <% } -%>
44
+ }
45
+
37
46
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
38
47
(const facebook::react::ObjCTurboModule::InitParams &)params
39
48
{
40
49
return std::make_shared<facebook::react::Native<%- project.name -%>SpecJSI>(params);
41
50
}
42
51
#endif
52
+ <% } -%>
43
53
44
54
@end
0 commit comments