Skip to content

Commit cb04bd3

Browse files
authored
Add Swift code to release levels example (#4923)
1 parent f75c626 commit cb04bd3

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

docs/releases/release-levels.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ id: release-levels
33
title: Release Levels
44
---
55

6+
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import constants from '@site/core/TabsConstants';
7+
68
React Native provides the community with the ability to adopt individual new features as soon as their design and implementation are nearly complete, even before they are included in a stable release. This approach is known as **release levels**.
79

810
You can configure the release level of React Native so that your React Native instance will initialize with Feature Flags set to either `EXPERIMENTAL`, `CANARY`, or `STABLE` modes.
@@ -44,8 +46,21 @@ The build system generates different feature flag override classes for each rele
4446

4547
The `RCTReactNativeFactory` class now has an initializer that accepts a `releaseLevel` parameter. The feature flag setup uses this parameter to select the correct feature flag overrides.
4648

47-
```objc title="Example usage"
49+
<Tabs groupId="ios-language" queryString defaultValue={constants.defaultAppleLanguage} values={constants.appleLanguages}>
50+
<TabItem value="objc">
51+
52+
```objc title="AppDelegate.mm"
4853
[[RCTReactNativeFactory alloc] initWithDelegate:delegate releaseLevel:Canary];
4954
```
5055
56+
</TabItem>
57+
<TabItem value="swift">
58+
59+
```swift title="AppDelegate.swift"
60+
let factory = RCTReactNativeFactory(delegate: delegate, releaseLevel: RCTReleaseLevel.Canary)
61+
```
62+
63+
</TabItem>
64+
</Tabs>
65+
5166
The system ensures that only one release level is active per app instance, and will crash if multiple factories are created with different release levels.

0 commit comments

Comments
 (0)