The #Preview macro is frustrating me! Test data that looks obvious to me fails to build. Here is a stripped down example:-
import SwiftUI
struct TestView: View {
@State private var intValue = 0
var body: some View {
TestMenuView(intValue: $intValue)
}
}
#Preview {
TestView()
}
struct TestMenuView: View {
@Binding var intValue: Int
var body: some View {
Text("Value passed in was ($intValue)")
}
}
#Preview {
TestMenuView(intValue: 1)
}
But the #Preview of TestMenuView gives the error:-
Cannot convert value of type ‘Int’ to expected argument type ‘Binding’
1