For the complete documentation index, see llms.txt. This page is also available as Markdown.

Native Module iOS

How to Create a Native Module in iOS

This detailed guide explains how to create a native module for the iOS platform within a React Native application. The process follows the step-by-step instructions from the official documentation.

1. Open the iOS Project in Xcode

You can include this in your package.json under the scripts section:

"scripts": {
    "open:ios": "xed ios"
},

This script ensures that the Expo module opens correctly in Xcode.

2. Create the Native Module

Create a file named CafSmartAuthBridgeModule.swift in the directory modules/caf-smart-auth-react-native/ios/. This file will contain the class that implements the native module.

Key Functions of the CafSmartAuthBridgeModule Class

  • build: Creates and configures an instance of the CafSmartAuthSdk using the provided parameters.

  • setupListener: Sets up a listener to monitor the status of authentication operations.

  • startSmartAuth: A method exposed to React Native to initiate smart authentication.

Example Implementation of the CafSmartAuthBridgeModule.swift File

3. Create the CafSmartAuthBridgeSettings.swift File

This file will handle the interpretation of data sent from React Native to the native module.

Example Implementation:

Last updated