Suppose I want to have a Set
of functions or closures. Here's how I would go about it:
typealias HandlerX = () -> ()
static var handlersX = Set<HandlerX>()
This produces the following compiler error:
Type 'HandlerX' (aka '() -> ()') does not conform to protocol 'Hashable'
Is this a dead end?
Yes, this is a dead end. Hashable isn't really your problem; there's no way to decide whether two closures are Equal (which is a base requirement of Hashable).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With