@State var shown = false
@State var text = ""
var body: some View {
ZStack{
//main page design ...
Button(action: {
self.text = ""
self.shown.toggle()
}){
Text("button")
}
if self.shown{
alertView(text: self.$text, shown: self.$shown) //alertView is Custom Alert
}
else{
alertView(text: self.$text, shown: self.$shown).hidden()
}
}
}