Chapter 4--Getting Error: Use of unresolved identifier 'ViewControllerRepresentation'

I am trying to adapt another project using the “Hosting a view controller in a SwiftUI Project”.

I use ViewController as instructed with the appropriate representation struct. But when I put in my Navigation from ContentView() I get this:

        NavigationView {
            
             VStack {


  NavigationLink(destination: ViewControllerRepresentation()) { //Use of unresolved identifier 'ViewControllerRepresentation'
    Text("PDF File")
}.padding(.bottom)

}

It’s like the ContentView() isn’t seeing the ViewController’s struct. I was thinking that when I brought in the storyboard and VC from another project they might not see each other. What am I missing here?

hi Garrett! make sure struct ViewControllerRepresentation is outside the ViewController class definition.

I’ll make this clearer in the next update of the book. Thanks!

Roger that. Thanks Audrey :grinning: