Installation
MarkdownRequirements
Section titled “Requirements”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
Installation
Section titled “Installation”Install the package and its Nitro Modules peer dependency using your preferred package manager:
# npmnpm install @mgcrea/react-native-swiftui react-native-nitro-modules
# pnpmpnpm add @mgcrea/react-native-swiftui react-native-nitro-modules
# yarnyarn add @mgcrea/react-native-swiftui react-native-nitro-modulesiOS Setup
Section titled “iOS Setup”After installing the package, install the iOS dependencies:
cd ios && pod install && cd ..Or using the library’s helper script:
npm run install:iosVerify Installation
Section titled “Verify Installation”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.
Next Steps
Section titled “Next Steps”- Learn the basics in the Quick Start guide
- Explore available Components
- Check out the Examples for real-world usage