I am trying to bind swiftui button action and getting the error like Cannot convert value of type 'Binding<() -> ()>' to expected argument type '() -> Void'
In View
Button(action : $viewModel.action ) {
Text("Login")
}
In ViewModel
class LoginViewModel: ObservableObject {
@Published var userid = ""
@Published var password = ""
@Published var selection : Int? = 0
//@Published var action : () -> void = {}
func action() {
}
}