问题描述
只是玩 Swift UI 基本应用程序,即使我处于画布模式,预览画布也没有显示.应用程序运行,我有这个小片段我缺少什么?
Just playing with Swift UI basic app and the preview canvas is not showing even though I'm in canvas mode. App runs, and I have this little snippet what am I missing?
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif
推荐答案
要在 Xcode 中预览画布中的视图并与之交互,请确保您的 Mac 在 Catalina MacOS 上运行.
To preview and interact with views from the canvas in Xcode, ensure your Mac is running on Catalina MacOS.
https://developer.apple.com/tutorials/swiftui/创建和组合视图
请查看以下网址中的苹果文档https://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_2_release_notes
Please check apple document in the following URLhttps://developer.apple.com/documentation/xcode_release_notes/xcode_11_beta_2_release_notes
Xcode 11 beta 支持使用 SwiftUI 进行开发.
注意
SwiftUI 开发工具仅在 macOS 上运行时可用Catalina 10.15 测试版.
Tools for SwiftUI development are only available when running on macOS Catalina 10.15 beta.
这篇关于Xcode 11 beta swift ui 预览未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!