Hi, I am currently running into a strange issue. I am talking to an external device which can send multiple sequential warnings.
I am using the new view.alert(title, isPresented, actions, message) modifier.
Sometimes it happens that the external message becomes irrelevant in which case I clear the isPresented Binding to remove the Alert and present the next one if there is one.
I use 2 ObjervableObjects - one that contains the isPresented flag and one for the content of the Message. If I reset isPresented, update the content ObservableObject and set isPresented again, the Alert window cannot get dismissid by setting isPresented to false again. The Alert just stays along and the new Alert does not get presented. (although somehow the UI believes it is presenting a new Alert)
I found that I need to wait a bit after clearing iPresented and do an DispatchQueue.main.asyncAfter to set my iPresented flag - to allow the Alert window to vanish and the views to update.
If there is a timing problem with dismissing the .alert - shouldn't there be a completion handler for the alert - obviously putting in a random delay seems hacky...?
Best, Michael