I’m fairly new to Swift and Xcode. I’ve been following along with Apple’s SwiftUI tutorials and haven’t had much problem, until I got to here: Interfacing with UIKit (https://developer.apple.com/tutorials/swiftui/interfacing-with-uikit)
When I get to step 5, the build is successful but there is no preview. The error I receive is:
“ RemoteHumanReadableError: Failed to update preview.
The preview process appears to have crashed.
Error encountered when sending 'render' message to agent.
==================================
| RemoteHumanReadableError: The operation couldn’t be completed. (BSServiceConnectionErrorDomain error 3.)
|
| BSServiceConnectionErrorDomain (3):
| ==BSErrorCodeDescription: OperationFailed”
Any help on what I’m doing wrong, and why it’s wrong would be great help :)
Edit: code added
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) })
.aspectRatio(3/2, contentMode: .fit)
}
}