小编Jos*_*lia的帖子

Apple 开发者 SwiftUI 教程的预览问题 - 框架集成接口与 UIKit

我对 Swift 和 Xcode 还很陌生。我一直在关注 Apple 的 SwiftUI 教程,并没有遇到太多问题,直到我来到这里:与 UIKit 交互(https://developer.apple.com/tutorials/swiftui/interface-with-uikit

当我到达第 5 步时,构建成功但没有预览。我收到的错误是:

“ RemoteHumanReadableError:无法更新预览。

预览过程似乎已崩溃。

向代理发送“渲染”消息时遇到错误。

==================================

| RemoteHumanReadableError: 操作无法完成。(BSServiceConnectionErrorDomain 错误 3。) |
| BSServiceConnectionErrorDomain (3): | ==BSErrorCodeDescription:操作失败”

对我做错了什么以及为什么错的任何帮助都会有很大帮助:)

编辑:添加了代码


import SwiftUI

struct PageView<Page: View>: View {
    var viewControllers: [UIHostingController<Page>]

    init(_ views: [Page]) {
        self.viewControllers = views.map { UIHostingController(rootView: $0) }
    }

    var body: some View {
        PageViewController(controllers: viewControllers)
    }
}

struct PageView_Previews: PreviewProvider {
    static var previews: some View {
        PageView(features.map { FeatureCard(landmark: $0) }) …
Run Code Online (Sandbox Code Playgroud)

xcode uikit swift swiftui

11
推荐指数
2
解决办法
1581
查看次数

标签 统计

swift ×1

swiftui ×1

uikit ×1

xcode ×1