In SwiftUI, I have a struct as shown below. There's a binding var that is a Bool. For the preview, what does Xcode expect in place of the Binding<Bool>
placeholder? true
and false
return the error: "Cannot convert value of type 'Bool' to expected argument type 'Binding'".
import SwiftUI
struct DetailShellView : View {
@Binding var isPresented: Bool
var testMessage: String
var body: some View {
VStack {
Button(action: {
self.isPresented = false
print("variable message: \(self.testMessage)")
}) {
Text("Close modal view")
}
Text(testMessage)
}
}
}
struct DetailShellView_Previews: PreviewProvider {
static var previews: some View {
DetailShellView(isPresented: <#Binding<Bool>#>, testMessage: "donuts")
}
}