Skip to content

Commit de47698

Browse files
authored
Merge pull request #687 from Iterable/new-arch/MOB-11827-add-new-architecture-support
[MOB-11827] add-new-architecture-support
2 parents a6245be + c3e1389 commit de47698

7 files changed

Lines changed: 677 additions & 354 deletions

File tree

Iterable-React-Native-SDK.podspec

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
require "json"
22

33
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
54

65
Pod::Spec.new do |s|
76
s.name = "Iterable-React-Native-SDK"
@@ -14,31 +13,20 @@ Pod::Spec.new do |s|
1413
s.platforms = { :ios => min_ios_version_supported }
1514
s.source = { :git => "https://github.com/Iterable/react-native-sdk.git", :tag => "#{s.version}" }
1615

17-
s.source_files = "ios/**/*.{h,m,mm,swift}"
18-
19-
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20-
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21-
if respond_to?(:install_modules_dependencies, true)
22-
install_modules_dependencies(s)
23-
else
24-
s.dependency "React-Core"
25-
26-
# Don't install the dependencies when we run `pod install` in the old architecture.
27-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
28-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
29-
s.pod_target_xcconfig = {
30-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
31-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
32-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
33-
}
34-
s.dependency "React-Codegen"
35-
s.dependency "RCT-Folly"
36-
s.dependency "RCTRequired"
37-
s.dependency "RCTTypeSafety"
38-
s.dependency "ReactCommon/turbomodule/core"
39-
end
40-
end
16+
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17+
s.private_header_files = "ios/**/*.h"
4118

19+
# Load Iterables iOS SDK as a dependency
4220
s.dependency "Iterable-iOS-SDK", "6.5.4"
43-
21+
22+
# Basic Swift support
23+
s.pod_target_xcconfig = {
24+
'DEFINES_MODULE' => 'YES',
25+
'CLANG_ENABLE_MODULES' => 'YES',
26+
'SWIFT_VERSION' => '5.0',
27+
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
28+
}
29+
30+
install_modules_dependencies(s)
31+
4432
end

example/ios/Podfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ prepare_react_native_project!
1313
linkage = ENV['USE_FRAMEWORKS']
1414
if linkage != nil
1515
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
16-
use_frameworks! :linkage => linkage.to_sym
16+
# IMPORTANT: New Architecture Issue solution
17+
# This is needed to use the Swift code from Iterable-iOS-SDK in the RNIterableAPI module
18+
use_frameworks! :linkage => :dynamic
1719
end
1820

1921
target 'ReactNativeSdkExample' do

example/ios/ReactNativeSdkExample.xcodeproj/project.pbxproj

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
00E356F31AD99517003FC87E /* ReactNativeSdkExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* ReactNativeSdkExampleTests.m */; };
1111
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
1212
779227342DFA3FB500D69EC0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 779227332DFA3FB500D69EC0 /* AppDelegate.swift */; };
13+
77F63EC390061314C0718D51 /* libPods-ReactNativeSdkExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F395BEFC7809290D1773C84F /* libPods-ReactNativeSdkExample.a */; };
1314
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
1415
A3A40C20801B8F02005FA4C0 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 1FC6B09E65A7BD9F6864C5D8 /* PrivacyInfo.xcprivacy */; };
15-
D8AD8DD7C4BBDAA8AE397A1B /* libPods-ReactNativeSdkExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1BA21919EC27D7F5BAE79A81 /* libPods-ReactNativeSdkExample.a */; };
1616
/* End PBXBuildFile section */
1717

1818
/* Begin PBXContainerItemProxy section */
@@ -33,15 +33,15 @@
3333
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ReactNativeSdkExample/Images.xcassets; sourceTree = "<group>"; };
3434
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ReactNativeSdkExample/Info.plist; sourceTree = "<group>"; };
3535
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeSdkExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
36-
1BA21919EC27D7F5BAE79A81 /* libPods-ReactNativeSdkExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeSdkExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
3736
1FC6B09E65A7BD9F6864C5D8 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = ReactNativeSdkExample/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
38-
24F802EFDCFB094D34916C72 /* Pods-ReactNativeSdkExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.release.xcconfig"; sourceTree = "<group>"; };
37+
627A5082522E8122626A42E9 /* Pods-ReactNativeSdkExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.debug.xcconfig"; sourceTree = "<group>"; };
3938
779227312DFA3FB500D69EC0 /* ReactNativeSdkExample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNativeSdkExample-Bridging-Header.h"; sourceTree = "<group>"; };
4039
779227322DFA3FB500D69EC0 /* ReactNativeSdkExampleTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNativeSdkExampleTests-Bridging-Header.h"; sourceTree = "<group>"; };
4140
779227332DFA3FB500D69EC0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = ReactNativeSdkExample/AppDelegate.swift; sourceTree = "<group>"; };
4241
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ReactNativeSdkExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
42+
C37A515B34C484F156F48110 /* Pods-ReactNativeSdkExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.release.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.release.xcconfig"; sourceTree = "<group>"; };
4343
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
44-
EDCEA27594161CE66029771A /* Pods-ReactNativeSdkExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNativeSdkExample.debug.xcconfig"; path = "Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample.debug.xcconfig"; sourceTree = "<group>"; };
44+
F395BEFC7809290D1773C84F /* libPods-ReactNativeSdkExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNativeSdkExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4545
/* End PBXFileReference section */
4646

4747
/* Begin PBXFrameworksBuildPhase section */
@@ -56,7 +56,7 @@
5656
isa = PBXFrameworksBuildPhase;
5757
buildActionMask = 2147483647;
5858
files = (
59-
D8AD8DD7C4BBDAA8AE397A1B /* libPods-ReactNativeSdkExample.a in Frameworks */,
59+
77F63EC390061314C0718D51 /* libPods-ReactNativeSdkExample.a in Frameworks */,
6060
);
6161
runOnlyForDeploymentPostprocessing = 0;
6262
};
@@ -99,7 +99,7 @@
9999
isa = PBXGroup;
100100
children = (
101101
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
102-
1BA21919EC27D7F5BAE79A81 /* libPods-ReactNativeSdkExample.a */,
102+
F395BEFC7809290D1773C84F /* libPods-ReactNativeSdkExample.a */,
103103
);
104104
name = Frameworks;
105105
sourceTree = "<group>";
@@ -138,8 +138,8 @@
138138
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
139139
isa = PBXGroup;
140140
children = (
141-
EDCEA27594161CE66029771A /* Pods-ReactNativeSdkExample.debug.xcconfig */,
142-
24F802EFDCFB094D34916C72 /* Pods-ReactNativeSdkExample.release.xcconfig */,
141+
627A5082522E8122626A42E9 /* Pods-ReactNativeSdkExample.debug.xcconfig */,
142+
C37A515B34C484F156F48110 /* Pods-ReactNativeSdkExample.release.xcconfig */,
143143
);
144144
path = Pods;
145145
sourceTree = "<group>";
@@ -169,13 +169,13 @@
169169
isa = PBXNativeTarget;
170170
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ReactNativeSdkExample" */;
171171
buildPhases = (
172-
F706883CA13F4E50A06B85B2 /* [CP] Check Pods Manifest.lock */,
172+
00A09C8D745F4A4962CFCB16 /* [CP] Check Pods Manifest.lock */,
173173
13B07F871A680F5B00A75B9A /* Sources */,
174174
13B07F8C1A680F5B00A75B9A /* Frameworks */,
175175
13B07F8E1A680F5B00A75B9A /* Resources */,
176176
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
177-
2128D4591E26BD193F1293F1 /* [CP] Embed Pods Frameworks */,
178-
BBD6908F2EAA6D3A6C078EA9 /* [CP] Copy Pods Resources */,
177+
70E3A2A47E764F7A78602595 /* [CP] Embed Pods Frameworks */,
178+
EDF40E5EF2B0A60C77B1B71B /* [CP] Copy Pods Resources */,
179179
);
180180
buildRules = (
181181
);
@@ -244,6 +244,28 @@
244244
/* End PBXResourcesBuildPhase section */
245245

246246
/* Begin PBXShellScriptBuildPhase section */
247+
00A09C8D745F4A4962CFCB16 /* [CP] Check Pods Manifest.lock */ = {
248+
isa = PBXShellScriptBuildPhase;
249+
buildActionMask = 2147483647;
250+
files = (
251+
);
252+
inputFileListPaths = (
253+
);
254+
inputPaths = (
255+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
256+
"${PODS_ROOT}/Manifest.lock",
257+
);
258+
name = "[CP] Check Pods Manifest.lock";
259+
outputFileListPaths = (
260+
);
261+
outputPaths = (
262+
"$(DERIVED_FILE_DIR)/Pods-ReactNativeSdkExample-checkManifestLockResult.txt",
263+
);
264+
runOnlyForDeploymentPostprocessing = 0;
265+
shellPath = /bin/sh;
266+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
267+
showEnvVarsInLog = 0;
268+
};
247269
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
248270
isa = PBXShellScriptBuildPhase;
249271
buildActionMask = 2147483647;
@@ -260,7 +282,7 @@
260282
shellPath = /bin/sh;
261283
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
262284
};
263-
2128D4591E26BD193F1293F1 /* [CP] Embed Pods Frameworks */ = {
285+
70E3A2A47E764F7A78602595 /* [CP] Embed Pods Frameworks */ = {
264286
isa = PBXShellScriptBuildPhase;
265287
buildActionMask = 2147483647;
266288
files = (
@@ -277,7 +299,7 @@
277299
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-frameworks.sh\"\n";
278300
showEnvVarsInLog = 0;
279301
};
280-
BBD6908F2EAA6D3A6C078EA9 /* [CP] Copy Pods Resources */ = {
302+
EDF40E5EF2B0A60C77B1B71B /* [CP] Copy Pods Resources */ = {
281303
isa = PBXShellScriptBuildPhase;
282304
buildActionMask = 2147483647;
283305
files = (
@@ -294,28 +316,6 @@
294316
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ReactNativeSdkExample/Pods-ReactNativeSdkExample-resources.sh\"\n";
295317
showEnvVarsInLog = 0;
296318
};
297-
F706883CA13F4E50A06B85B2 /* [CP] Check Pods Manifest.lock */ = {
298-
isa = PBXShellScriptBuildPhase;
299-
buildActionMask = 2147483647;
300-
files = (
301-
);
302-
inputFileListPaths = (
303-
);
304-
inputPaths = (
305-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
306-
"${PODS_ROOT}/Manifest.lock",
307-
);
308-
name = "[CP] Check Pods Manifest.lock";
309-
outputFileListPaths = (
310-
);
311-
outputPaths = (
312-
"$(DERIVED_FILE_DIR)/Pods-ReactNativeSdkExample-checkManifestLockResult.txt",
313-
);
314-
runOnlyForDeploymentPostprocessing = 0;
315-
shellPath = /bin/sh;
316-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
317-
showEnvVarsInLog = 0;
318-
};
319319
/* End PBXShellScriptBuildPhase section */
320320

321321
/* Begin PBXSourcesBuildPhase section */
@@ -406,7 +406,7 @@
406406
};
407407
13B07F941A680F5B00A75B9A /* Debug */ = {
408408
isa = XCBuildConfiguration;
409-
baseConfigurationReference = EDCEA27594161CE66029771A /* Pods-ReactNativeSdkExample.debug.xcconfig */;
409+
baseConfigurationReference = 627A5082522E8122626A42E9 /* Pods-ReactNativeSdkExample.debug.xcconfig */;
410410
buildSettings = {
411411
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
412412
CLANG_ENABLE_MODULES = YES;
@@ -436,7 +436,7 @@
436436
};
437437
13B07F951A680F5B00A75B9A /* Release */ = {
438438
isa = XCBuildConfiguration;
439-
baseConfigurationReference = 24F802EFDCFB094D34916C72 /* Pods-ReactNativeSdkExample.release.xcconfig */;
439+
baseConfigurationReference = C37A515B34C484F156F48110 /* Pods-ReactNativeSdkExample.release.xcconfig */;
440440
buildSettings = {
441441
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
442442
CLANG_ENABLE_MODULES = YES;

ios/RNIterableAPI/RNIterableAPI.h

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
//
2-
// RNIterableAPI.h
3-
// RNIterableAPI
4-
//
5-
// Created by Loren Posen on 6/11/25.
6-
// Copyright © 2025 Iterable. All rights reserved.
7-
//
8-
#import <React/RCTBridgeModule.h>
1+
#import <Foundation/Foundation.h>
2+
#import <React/RCTEventEmitter.h>
3+
4+
#if RCT_NEW_ARCH_ENABLED
5+
6+
#import <React/RCTUtils.h>
7+
#import <React/RCTConvert.h>
8+
#import <React/RCTTurboModuleRegistry.h>
9+
#import <RNIterableAPISpec/RNIterableAPISpec.h>
10+
@interface RNIterableAPI : RCTEventEmitter <NativeRNIterableAPISpec>
11+
12+
#else
13+
#import <React/RCTBridgeModule.h>
14+
@interface RNIterableAPI : RCTEventEmitter <RCTBridgeModule>
15+
16+
#endif
17+
18+
@end

0 commit comments

Comments
 (0)