# Create the iOS bridge

Create the native files for your module by opening your workspace file on Xcode, select your project, and right-click to add a new file. Select *Cocoa Touch Class,* give the name, and create it.&#x20;

### Step 1 - `BridgeClassDemo.h`

Create the bridge by copying the code below into your `BridgeClassDemo.h` file&#x20;

{% code title="BridgeClassDemo.h" %}

```swift
//
//  BridgeClassDemo.h
//  RaxelPulseReactNativeDemo
//
//  Created by Sergey Emelyanov on 19/04/2020.
//  Copyright © 2020 Data motion Pte.Ltd. All rights reserved.
//  https://telematicssdk.com

#import "React/RCTBridgeModule.h"

// Instead of BridgeClassDemo put the name of your module
@interface BridgeClassDemo : NSObject <RCTBridgeModule>
@end
```

{% endcode %}

### Step 2 - `DemoClass.m`

Add the code below into your `DemoClass.m` file:

{% code title="DemoClass.m" %}

```swift
//
//  BridgeClassDemo.m
//  RaxelPulseReactNativeDemo
//
//  Created by Sergey Emelyanov on 19/04/2020.
//  Copyright © 2020 Data motion Pte.Ltd. All rights reserved.
//  https://telematicssdk.com

#import <React/RCTLog.h>
#import <RaxelPulse/RaxelPulse.h>
#import <AdSupport/AdSupport.h>
#import "BridgeClassDemo.h" // Here put the name of your module

@implementation BridgeClassDemo // Here put the name of your module

// This RCT (React) "macro" exposes the current module to JavaScript

RCT_EXPORT_MODULE(BridgeClassDemo);

RCT_EXPORT_METHOD(start:(NSString *)token) {
  dispatch_async(dispatch_get_main_queue(), ^{
    [RPEntry instance].virtualDeviceToken = @"DeviceToken";
    [RPEntry instance].disableTracking = NO;
  });
}

RCT_EXPORT_METHOD(enableSDK) {
  dispatch_async(dispatch_get_main_queue(), ^{
      [[RPEntry instance] setEnableSdk: true];
  });
}

RCT_EXPORT_METHOD(disableSDK) {
  dispatch_async(dispatch_get_main_queue(), ^{
      [[RPEntry instance] setDisableWithUpload];
  });
}

/** You can add any required methods by yourself 
* using this code as a template

RCT_EXPORT_METHOD(yourmetod) {
  dispatch_async(dispatch_get_main_queue(), ^{
      //Your native command
  });
}

*/

@end
```

{% endcode %}

### Step 3 - AppDelegate

Handle library methods for AppDelegate as it is in the example below:

```java
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTRootView.h>
#import <RaxelPulse/RaxelPulse.h>
#import <React/RCTLog.h>
#import <AdSupport/AdSupport.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [[RPCPermissionsWizard returnInstance] launchWithFinish:^(BOOL showWizzard) {
    [RPEntry initializeWithRequestingPermissions:YES];
  }];
  RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
  RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
    moduleName:@"RCdemo_mobile"
    initialProperties:nil];
  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}
  
- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(nonnull NSString *)identifier completionHandler:(nonnull void (^)(void))completionHandler {
  [RPEntry application:application handleEventsForBackgroundURLSession:identifier completionHandler:completionHandler];
}
  
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
  [RPEntry applicationDidReceiveMemoryWarning:application];
}
  
- (void)applicationWillTerminate:(UIApplication *)application {
  [RPEntry applicationWillTerminate:application];
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
  [RPEntry applicationDidEnterBackground:application];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
  [RPEntry applicationDidBecomeActive:application];
}

- (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
  [RPEntry application:application performFetchWithCompletionHandler:^{
    completionHandler(UIBackgroundFetchResultNewData);
  }];
}

@end
```

And that’s it for the native side.&#x20;

### Step 4 - React Native side

We can now call it anywhere on the React Native side:

```java
import { NativeModules } from 'react-native';
var BridgeClassDemo = NativeModules.BridgeClassDemo;
//Let's show it
BridgeClassDemo.start(@"DeviceToken")
BridgeClassDemo.enableSDK()
BridgeClassDemo.disableSDK()
//BridgeClassDemo.yourmetod()
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-old.telematicssdk.com/sdk-installation/ios-sdk-intallation/install-the-ios-library/create-the-ios-bridge.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
