Skip to content

Installation

Markdown

Before installing, ensure your project meets these requirements:

  • React Native 0.78 or later (New Architecture enabled)
  • iOS 15.1 or later
  • Node.js 18 or later

Install the package and its Nitro Modules peer dependency using your preferred package manager:

Terminal window
# npm
npm install @mgcrea/react-native-swiftui react-native-nitro-modules
# pnpm
pnpm add @mgcrea/react-native-swiftui react-native-nitro-modules
# yarn
yarn add @mgcrea/react-native-swiftui react-native-nitro-modules

After installing the package, install the iOS dependencies:

Terminal window
cd ios && pod install && cd ..

Or using the library’s helper script:

Terminal window
npm run install:ios

Create a simple test component to verify the installation:

import { SwiftUI } from '@mgcrea/react-native-swiftui';
import { View } from 'react-native';
export function TestSwiftUI() {
return (
<View style={{ flex: 1 }}>
<SwiftUI style={{ flex: 1 }}>
<SwiftUI.Text text="Hello from SwiftUI!" />
</SwiftUI>
</View>
);
}

If you see “Hello from SwiftUI!” rendered with native iOS styling, the installation was successful.