borchero borchero - 2 years ago 152
Swift Question

Get handler of UIAlertAction in Swift

How is it possible to get the handler of a

in Swift. It is set when initializing however I haven't found any property to get hold on the closure of the action. The closure is of type
(UIAlertAction) -> Void
however I would like to get the content of the closure so that I have some closure like
() -> Void
. Is this possible? Thanks for your answers

Answer Source

There is NO member/property exposed by the UIAlertAction class. However we can manage this by ourselves by subclassing UIAlertAction and have some member named, say, "actionHandler" to store that.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download