I have created a class which allows me to customize a UIAlertAction whenever I need. The problem is that I need to do something, call a function which is inside another class, after the user presses delete (the option other than cancel)
What I tried:
let dAction = ActionButtonOptions(isReportButton: false, selectedPost: selectedPost!, numberMedia: numberMedia, forP3: true)
self.present(dAction.action, animated: true, completion: {
if dAction.hasDeleted {
print("83908120938292180918309123 ", dAction.hasDeleted)
self.nextGestureMethods()//these two things are teh things I need to do
self.selectedPost?.interimMedia.remove(at: self.numberMedia-1)
} else {
print("837vgvgvgvgvgvgvgv908120938292180918309123", dAction.hasDeleted)
}
})
Update: I believe the code above does not work because teh completion runs after the presenting is complete not when the user finished interacting with the popup.
inside of that other class: if the user presses the delete button I make the hasDeleted variable true. The problem is that the code in the completion seems to just go strait to the else.
How can I accomplish what I am intending?