Hi Team,
Basically this is the code i want to understand why typealias is used
typealias DownloadCountHandler = (Int)->()
var onDownloadFileCompleteCount : DownloadCountHandler?{
didSet{
if onDownloadFileCompleteCount != nil{
}else{
}
}
}
i am calling initiallizing this as
if let onDownloadFileCompleteCount = self.onDownloadFileCompleteCount{
self.DownloadCompleteCount(completionHandler: onDownloadFileCompleteCount)
}
this code is fine but when i write the same code as
var onDownloadFileCompleteCount : (Int)->(){
didSet{
if onDownloadFileCompleteCount != nil{
}else{
}
}
}
and then i am calling initiallizing this as
if let onDownloadFileCompleteCount = self.onDownloadFileCompleteCount{
self.DownloadCompleteCount(completionHandler: onDownloadFileCompleteCount)
}
and the i am getting error as Initializer for conditional binding must have Optional type, not ‘(Int) → ()’