I have created a @StateObject
from where a Login page is presented:
@StateObject var loginViewModel = //LoginViewModel Name
and There is a Button inside Vstack like this
VStack{
Button(action : {loginViewModel.show.toggle()} )
{
HStack{
Text("Button")
}
}. sheet (isPresented : $loginViewModel.show){
//View (passing viewModel)
}
}
The problem is tappable area is now spread to the entire screen. That is I am getting the login view when tapping on all other elements (pretty much everywhere in the screen) in the screen instead of that button area.
Any solution for this and to confine that button action around that button only?