mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
feat(iOS): expose RCT_NEW_ARCH_ENABLED to Swift (#46749)
Summary:
This PR exposes `RCT_NEW_ARCH_ENABLED` flag to Swift.
It allows you to use conditional compilation:
```swift
#if RCT_NEW_ARCH_ENABLED
func test() {
print("I'm running on new arch!)
}
#else
func test() {
print("I'm running on old arch!)
}
#endif
```
## Changelog:
[IOS] [ADDED] - expose RCT_NEW_ARCH_ENABLED to Swift
Pull Request resolved: https://github.com/facebook/react-native/pull/46749
Test Plan: CI Green
Reviewed By: cortinico
Differential Revision: D63689711
Pulled By: cipolleschi
fbshipit-source-id: 706013019571f597d1966ffcf13bd47ba7f29a2d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
80122678e0
commit
d24507611d
@@ -99,6 +99,7 @@ class NewArchitectureHelper
|
||||
|
||||
|
||||
ReactNativePodsUtils.add_flag_to_map_with_inheritance(current_config, "OTHER_CPLUSPLUSFLAGS", self.computeFlags(new_arch_enabled))
|
||||
ReactNativePodsUtils.add_flag_to_map_with_inheritance(current_config, "OTHER_SWIFT_FLAGS", new_arch_enabled ? " -DRCT_NEW_ARCH_ENABLED" : "")
|
||||
|
||||
spec.dependency "React-RCTFabric" # This is for Fabric Component
|
||||
spec.dependency "ReactCodegen"
|
||||
|
||||
Reference in New Issue
Block a user