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
to
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 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() } }