I'm in an odd state where it would help me a lot if I could compare 2 closures to see if they are the same reference object. I tried this:
let closure1 = { (a:String) in print(a)}
let closure2 = closure1
if closure1 as AnyObject === closure2 as AnyObject {
print("success")
}
This doesn't work, I know it seems silly, but being able to do this comparison will simplify something I'm working on. Did I miss something, I have done reference comparisons like this in the past in swift, is there something about closures that makes this not valid? Is there another way to do something like this?