How do you declare an optional closure as a property in Swift?
I am using this code:
var respondToButton:(sender: UIButton) -> Bool
I believe you just need to wrap the closure type in parenthesis, like so:
var respondToButton:((sender: UIButton) -> Bool)?
Alternatively if this is a closure type you're going to use often you can create a typealias to make it more readable:
typealias buttonResponder = (sender: UIButton) -> Bool
then in your class:
var respondToButton:buttonResponder?