Reputation: 26652
We know that in Swift we can do the following:
if myHandler = myOptionalHandler
{
myHandler()
}
However, this seems a trifle long winded. Is there a shorter way?
Upvotes: 2
Views: 70
Reputation: 26652
There is a shorter way! Simply execute the optional closure as follows:
myOptionalHandler?()
Upvotes: 2