Reputation: 21
I am using swift UI code as below
struct ABC_Previews: PreviewProvider {
@Binding var boolVar : Bool
static var previews: some View {
FilterDeviceList(isCloseView: isCloseView)
}
}
But its throwing error like "Instance member 'boolVar' cannot be used on type 'ABC_Previews' "
Upvotes: 1
Views: 360
Reputation: 257779
Because previews
is static
, ie type-wide
You can use something like
static var previews: some View {
FilterDeviceList(isCloseView: .constant(true)) // if binding is expected
}
Upvotes: 3