Hopefully, this is an easy question. I am attempting to pass to the FilterViewa struct from the FilterView_Previews struct @Binding value that is a Bool like this:
import SwiftUI
struct FilterView: View {
@Binding var isNavigationBarHidden: Bool
var body: some View {
ZStack {
Text("Filters go here")
}
.navigationBarTitle("")
.onAppear {
self.isNavigationBarHidden = false
}
}
}
#if DEBUG
struct FilterView_Previews: PreviewProvider {
var isHidden: Bool = true
static var previews: some View {
FilterView(isNavigationBarHidden: isHidden)
}
}
#endif
However, the value isHidden is getting flagged with a 'Cannot convert value of type 'Bool' to expected argument type 'Binding'. In this scenario, how do you create an appropriate @Binding value within the FilterView_Previews struct that satisfies the compiler?