技能 编程开发 在 Expo 中集成 SwiftUI 视图

在 Expo 中集成 SwiftUI 视图

v20260427
expo-ui-swift-ui
本技能指导开发者如何使用 `@expo/ui/swift-ui` 包,将原生的 SwiftUI 视图和修饰器集成到 Expo 应用中。这对于在跨平台 React Native 环境中构建真实的、平台特定的 iOS 用户界面至关重要,尤其适用于针对 Expo SDK 55 的开发需求,掌握在 RN 中嵌入 SwiftUI 视图的方法。
获取技能
466 次下载
概览

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>;

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
信息
Category 编程开发
Name expo-ui-swift-ui
版本 v20260427
大小 2.27KB
更新时间 2026-04-28
语言