I am using the code in the book to host a ViewController in a SwiftUI project. I use instead of “ViewController”, “DocumentSaveViewController” and my StoryBoard ID is “DocumentSave”. Compiles okay but when I hit the Text(“Save File”) I get a Thread 1: signal SIGABRT and in the DocumentSaveViewController’s ViewControllerRepresentation struct :
struct ViewControllerRepresentation: UIViewControllerRepresentable {
func makeUIViewController(
context: UIViewControllerRepresentableContext
) → DocumentSaveViewController {
UIStoryboard(name: “Main”, bundle: nil)
.instantiateViewController(withIdentifier: “DocumentSave”)
as! DocumentSaveViewController // this is the line where the program stops
}
func updateUIViewController(_ uiViewController: DocumentSaveViewController,
context: UIViewControllerRepresentableContext
) {
}
}
This struct is outside the DocumentSaveViewController class. Is this because I don’t use “ViewController”?