Introduction

Real SwiftUI views in your React Native app, generated from Apple's SDK.

swiftui-react-native renders real SwiftUI. A <Toggle> is SwiftUI's Toggle, a <List> is SwiftUI's List, and a modifier like .padding() is the SwiftUI modifier, applied to the SwiftUI view.

import { Text, VStack, compose } from 'swiftui-react-native';

export function Greeting() {
  return (
    <VStack spacing={8}>
      <Text modifiers={compose().font('title').bold()}>Hello</Text>
      <Text modifiers={compose().foregroundStyle('secondary')}>From SwiftUI</Text>
    </VStack>
  );
}

Generated, not wrapped

Most of the library isn't written by hand. It's generated from the SwiftUI that ships with Xcode: every initializer becomes a set of props, every modifier becomes a method on compose(), and every value type becomes a typed JavaScript value. When Apple adds an API, it shows up after the next generation.

This reference is generated the same way. Each page comes from the same declarations as the code, so the props, types and availability you read here are the ones you get.

New here? What it is explains how the pieces fit, Why SwiftUI covers the motivation, and History tells where the project came from.

Requirements

  • iOS, with the New Architecture
  • React Native 0.80 or newer
  • react-native-nitro-modules