I'm having a hard time understanding a problem I'm having. To simplify, I'll use UIView method. Basically, if I write the method
UIView.animateWithDuration(1, animations: {() in
}, completion:{(Bool) in
println("test")
})
it works fine. Now, if I do the same method, but creating a string like so:
UIView.animateWithDuration(1, animations: {() in
}, completion:{(Bool) in
String(23)
})
It stops working. Compiler error: Missing argument for parameter 'delay' in call
Now, here's the strange part. If I do the exact same code as the one that fails, but just add a print command like so:
UIView.animateWithDuration(1, animations: {() in
}, completion:{(Bool) in
String(23)
println("test")
})
it starts to work again.
My problem is basically the same thing. My code:
downloadImage(filePath, url: url) { () -> Void in
self.delegate?.imageDownloader(self, posterPath: posterPath)
}
Doesn't work. But if I change to.
downloadImage(filePath, url: url) { () -> Void in
self.delegate?.imageDownloader(self, posterPath: posterPath)
println("test")
}
or even:
downloadImage(filePath, url: url) { () -> Void in
self.delegate?.imageDownloader(self, posterPath: posterPath)
self.delegate?.imageDownloader(self, posterPath: posterPath)
}
It works fine. I can't understand why this is happening. I'm close to accept that it's a compiler bug.