"Missing Arguement for parameter 'navBarHidden' in call" Error

Hi everyone! I am having difficulty with an error that I can't seem to solve. I've been trying to make my navigation bars from previous views hide. I finally found the code that I needed, but then I got this error. It is coming from the preview code at the bottom. It says that I need to change
Code Block
happy()

to
Code Block
happy(navBarHidden: <#Binding<Bool>#>)

But, when I do this, it gives me another error saying "Editor Placeholder in Source File" I know it wants me to replace this text with something, but I'm not sure what. Any suggestions?

Thank you very much!
Tyler Nichols

Code Block import SwiftUI
import Swift
struct happy: View {
  @State private var happy = ["chicken", "burgers", "roast beef"]
     
  @State private var editMode = EditMode.inactive
   
  @Binding var navBarHidden : Bool
   
  var body: some View {
    NavigationView {
      VStack{
        List {
          ForEach(happy, id: \.self) { good in
            Text(good)
          }
        }
        .navigationBarTitle("My Happy Food", displayMode: .inline)
        .onAppear() {
          self.navBarHidden = false
           
          }
        .navigationBarItems(leading: EditButton())
        .environment(\.editMode, $editMode)
        }
      }
    }
  }
struct Good_Previews: PreviewProvider {
  static var previews: some View {
    happy()
  }
}


happy requires that a Binding<Bool> be passed to it. There are two ways that I suggest you achieve this:

Firstly, you can use the constant static method to quickly show the view in the preview canvas in its different states just by changing the boolean value.
Code Block Swift
struct Good_Previews: PreviewProvider {
static var previews: some View {
happy(navBarHidden: .constant(true))
}
}
This is probably the preferred way for previewing and testing.

The other way is to just use a State property, changing that, and pass that binding to the view as normal.
Code Block Swift
struct Good_Previews: PreviewProvider {
@State static private var navBarHidden = true
static var previews: some View {
happy(navBarHidden: $navBarHidden)
}
}

"Missing Arguement for parameter 'navBarHidden' in call" Error
 
 
Q