.alert(isPresented: self.$addANoteAlert) {
AlertViewPOP(
isPresented: self.$addANoteAlert,
title: "Alert Title",
message: "This is a message.",
actionTitle: "OK",
actionHandler: {
// Handle the OK action
print("OK tapped")
}
)
}
When I am trying to add this in view, I get this error:
Cannot convert value of type 'AlertViewPOP' to closure result type 'Alert'
alert(isPresented:content:)
modifier expects a closure that returns an Alert, not a custom view (AlertViewPOP).if you want to use your custom alert try using sheet or you can render it in your view by using a alert flag State var something like this :