11## Swift
22
3- React Native Brownfield provides first-class support for Swift.
3+ React Native Brownfield provides first-class support for Swift.
44
55### API Reference
66
@@ -30,27 +30,27 @@ ReactNativeBrownfield.shared
3030
3131** Properties:**
3232
33- | Property | Type | Default | Description |
34- | -------------------------- | ----------------------- | -------------- | -------------------------------------------------- |
35- | ` entryFile ` | ` String ` | index | Path to JavaScript root. |
36- | ` fallbackResource ` | ` String? ` | nil | Path to bundle fallback resource. |
37- | ` bundlePath ` | ` String ` | main.jsbundle | Path to bundle fallback resource. |
33+ | Property | Type | Default | Description |
34+ | ------------------ | --------- | --------------- | --------------------------------------------------------- |
35+ | ` entryFile ` | ` String ` | ` index ` | Path to JavaScript root. |
36+ | ` fallbackResource ` | ` String? ` | ` nil ` | Path to bundle fallback resource. |
37+ | ` bundlePath ` | ` String ` | ` main.jsbundle ` | Path to bundle fallback resource. |
38+ | ` bundle ` | ` Bundle ` | ` Bundle.main ` | Bundle instance to lookup the JavaScript bundle resource. |
3839
3940---
4041
4142** Methods:**
4243
43-
4444` startReactNative `
4545
4646Starts React Native. You can use it to initialize React Native in your app.
4747
4848Params:
4949
50- | Param | Required | Type | Description |
51- | ----------------------- | -------- | ------------------- | --- -------------------------------------------------- |
52- | ` onBundleLoaded ` | No | ` (() -> Void)? ` | Callback invoked after JS bundle is fully loaded. |
53- | ` launchOptions ` | No | ` [AnyHashable: Any]? ` | Launch options, typically passed from AppDelegate. |
50+ | Param | Required | Type | Description |
51+ | ---------------- | -------- | --------------------- | -------------------------------------------------- |
52+ | ` onBundleLoaded ` | No | ` (() -> Void)? ` | Callback invoked after JS bundle is fully loaded. |
53+ | ` launchOptions ` | No | ` [AnyHashable: Any]? ` | Launch options, typically passed from AppDelegate. |
5454
5555Examples:
5656
@@ -76,11 +76,11 @@ Creates a React Native view for the specified module name.
7676
7777Params:
7878
79- | Param | Required | Type | Description |
80- | ----------------------- | -------- | ------------------- | ----------------------------------------------------- |
81- | ` moduleName ` | Yes | ` String ` | Name of React Native component registered to ` AppRegistry ` . |
82- | ` initialProps ` | No | ` [AnyHashable: Any]? ` | Initial properties to be passed to React Native component. |
83- | ` launchOptions ` | No | ` [AnyHashable: Any]? ` | Launch options, typically passed from AppDelegate. |
79+ | Param | Required | Type | Description |
80+ | --------------- | -------- | --------------------- | ----------------------------------------------------------- |
81+ | ` moduleName ` | Yes | ` String ` | Name of React Native component registered to ` AppRegistry ` . |
82+ | ` initialProps ` | No | ` [AnyHashable: Any]? ` | Initial properties to be passed to React Native component. |
83+ | ` launchOptions ` | No | ` [AnyHashable: Any]? ` | Launch options, typically passed from AppDelegate. |
8484
8585Examples:
8686
@@ -105,7 +105,7 @@ import ReactBrownfield
105105
106106class AppDelegate : UIResponder , UIApplicationDelegate {
107107 var window: UIWindow?
108-
108+
109109 func application (_ application : UIApplication, didFinishLaunchingWithOptions launchOptions : [UIApplication.LaunchOptionsKey: Any ]? ) -> Bool {
110110 ReactNativeBrownfield.shared .startReactNative {
111111 print (" React Native bundle loaded" )
@@ -124,7 +124,7 @@ import ReactBrownfield
124124class ViewController : UIViewController {
125125 @IBAction func openReactNativeScreen (_ sender : UIButton) {
126126 let reactNativeVC = ReactNativeViewController (moduleName : " ReactNative" )
127-
127+
128128 present (reactNativeVC, animated : true )
129129 }
130130}
@@ -143,7 +143,7 @@ struct MyApp: App {
143143 print (" React Native bundle loaded" )
144144 }
145145 }
146-
146+
147147 var body: some Scene {
148148 WindowGroup {
149149 ContentView ()
@@ -164,7 +164,7 @@ struct ContentView: View {
164164 VStack {
165165 Text (" Welcome to the Native App" )
166166 .padding ()
167-
167+
168168 NavigationLink (" Push React Native Screen" ) {
169169 ReactNativeView (moduleName : " ReactNative" )
170170 .navigationBarHidden (true )
@@ -197,10 +197,10 @@ import ReactBrownfield
197197
198198` ReactNativeViewController(moduleName: moduleName, initialProperties: initialProperties) `
199199
200- | Param | Required | Type | Description |
201- | ------------------ | --------- | --------------- | -- ----------------------------------------------------------- |
202- | ` moduleName ` | Yes | ` String ` | Name of React Native component registered to ` AppRegistry ` . |
203- | ` initialProperties ` | No | ` [String: Any]? ` | Initial properties to be passed to React Native component. |
200+ | Param | Required | Type | Description |
201+ | ------------------- | -------- | ---------------- | ----------------------------------------------------------- |
202+ | ` moduleName ` | Yes | ` String ` | Name of React Native component registered to ` AppRegistry ` . |
203+ | ` initialProperties ` | No | ` [String: Any]? ` | Initial properties to be passed to React Native component. |
204204
205205Examples:
206206
@@ -230,10 +230,10 @@ import ReactBrownfield
230230
231231` ReactNativeView(moduleName: moduleName, initialProperties: initialProperties) `
232232
233- | Param | Required | Type | Description |
234- | ------------------- | --------- | -------------- | -- ----------------------------------------------------------- |
235- | ` moduleName ` | Yes | ` String ` | Name of React Native component registered to ` AppRegistry ` . |
236- | ` initialProperties ` | No | ` [String: Any] ` | Initial properties to be passed to React Native component. |
233+ | Param | Required | Type | Description |
234+ | ------------------- | -------- | --------------- | ----------------------------------------------------------- |
235+ | ` moduleName ` | Yes | ` String ` | Name of React Native component registered to ` AppRegistry ` . |
236+ | ` initialProperties ` | No | ` [String: Any] ` | Initial properties to be passed to React Native component. |
237237
238238Examples:
239239
0 commit comments