I have a simple class where I declare a block as a variable:
class MyObject : NSObject
{
var progressBlock:(progress:Double) -> ()?
init() { }
}
The way you have written it, the compiler assumes progressBlock is a closure that returns an optional empty tuple instead of an optional closure that returns an empty tuple. Try writing it like this instead:
class MyObject:NSObject {
var progressBlock:((progress:Double) -> ())?
init() {
progressBlock = nil
progressBlock = { (Double) -> () in /* code */ }
}
}