This is documentation for the next SDK version. For up-to-date documentation, see the latest version (SDK 56).
SwiftUI
使用 @expo/ui 构建原生 iOS 界面的 SwiftUI 组件。
iOS
tvOS
Included in Expo Go
For the complete documentation index, see llms.txt. Use this file to discover all available pages.
SwiftUI 组件位于 @expo/ui/swift-ui 中,允许你使用 React Native 中的 SwiftUI 构建完全原生的 iOS 界面。
安装
Terminal
- npx expo install @expo/uiIf you are installing this in an existing React Native app, make sure to install expo in your project.
用法
使用 @expo/ui/swift-ui 中的组件时,需要将其包装在 Host 组件中。Host 是 SwiftUI 视图的容器。
import { Host, Button } from '@expo/ui/swift-ui'; export function SaveButton() { return ( <Host style={{ flex: 1 }}> <Button label="保存更改" /> </Host> ); }
更多信息请参阅以下资源:
Expo UI Swift UI 指南
了解 @expo/ui/swift-ui 的基础知识
使用 SwiftUI 扩展
创建可与 Expo UI 集成的自定义 SwiftUI 组件和修饰器。

Expo UI iOS Liquid Glass 教程
了解如何在你的 React Native 应用中使用新的 Expo UI 构建真正的 SwiftUI 视图。