技能 编程开发 Expo SwiftUI 集成指南

Expo SwiftUI 集成指南

v20260406
expo-ui-swift-ui
介绍在 Expo SDK 55 中通过 @expo/ui/swift-ui 构建 iOS 原生界面的方法,要求 SwiftUI 树包裹在 Host 内,用 RNHostView 嵌入 RN 组件,并提醒先查阅对应的 SDK 55 文档和扩展指引。
获取技能
156 次下载
概览

name: expo-ui-swift-ui description: @expo/ui/swift-ui package lets you use SwiftUI Views and modifiers in your app.

The instructions in this skill apply to SDK 55 only. For other SDK versions, refer to the Expo UI SwiftUI docs for that version for the most accurate information.

When to Use

  • You need to build iOS-native UI in Expo using @expo/ui/swift-ui.
  • The task involves selecting SwiftUI views or modifiers, wrapping trees in Host, or embedding React Native components with RNHostView.
  • You are targeting Expo SDK 55 behavior for SwiftUI integration and extension guidance.

Installation

npx expo install @expo/ui

A native rebuild is required after installation (npx expo run:ios).

Instructions

import { Host, VStack, RNHostView } from "@expo-ui/swift-ui";
import { Pressable } from "react-native";

<Host matchContents>
  <VStack>
    <RNHostView matchContents>
      // Here, `Pressable` is an RN component so it is wrapped in `RNHostView`.
      <Pressable />
    </RNHostView>
  </VStack>
</Host>;
信息
Category 编程开发
Name expo-ui-swift-ui
版本 v20260406
大小 1.96KB
更新时间 2026-04-07
语言