borchero borchero - 1 year ago 126
Swift Question

Get handler of UIAlertAction in Swift

How is it possible to get the handler of a

UIAlertAction
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