iOS Native Modules

React Native 8 min min read Updated: Aug 03, 2026 Advanced
iOS Native Modules
Advanced Topic 7 of 18

iOS Native Modules

Writing a custom iOS native module allows you to expose Swift or Objective-C functionality directly to your React Native JavaScript code. This tutorial walks through creating a basic iOS native module.

Creating the Native Module in Swift

swift @objc(ToastModule) class ToastModule: NSObject { @objc(show:) func show(_ message: String) { DispatchQueue.main.async { // Display native alert or toast-like message print(message) } } }

Creating the Objective-C Bridge File

objectivec #import @interface RCT_EXTERN_MODULE(ToastModule, NSObject) RCT_EXTERN_METHOD(show:(NSString *)message) @end

Calling the Module from JavaScript

javascript import { NativeModules } from 'react-native'; const { ToastModule } = NativeModules; ToastModule.show('Hello from iOS!');

Returning Values with Promises

swift @objc(getDeviceName:rejecter:) func getDeviceName(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { resolve(UIDevice.current.name) }

Installing Pods After Adding Native Code

bash cd ios && pod install

Rebuilding the App

Just like Android, any new or modified iOS native module requires a full app rebuild through Xcode or the React Native CLI rather than relying on Fast Refresh.

bash npx react-native run-ios

Conclusion

Writing custom iOS native modules allows you to expose Swift or Objective-C functionality directly to your React Native JavaScript code, unlocking access to iOS-specific APIs and SDKs.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators