Skip to content

Commit

Permalink
feat(iOS): expose RCT_NEW_ARCH_ENABLED to Swift (#46749)
Browse files Browse the repository at this point in the history
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: #46749

Test Plan: CI Green

Reviewed By: cortinico

Differential Revision: D63689711

Pulled By: cipolleschi

fbshipit-source-id: 706013019571f597d1966ffcf13bd47ba7f29a2d
  • Loading branch information
okwasniewski authored and facebook-github-bot committed Oct 1, 2024
1 parent 8012267 commit d245076
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def self.install_modules_dependencies(spec, new_arch_enabled, folly_version = ge


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"
Expand Down

0 comments on commit d245076

Please sign in to comment.