I am trying to use closure Xcode8 beta4 with Swift3 , but it does not working. Same functions with closure working in Swift2.2, but it fails in Swift3.
Swift 2.2
UIView.animateWithDuration(0.5, animations: {
self.viewForInstagramLoginWebView.frame = CGRectMake(x, y,self.viewForInstagramLoginWebView.frame.size.width , self.viewForInstagramLoginWebView.frame.size.height)
}) { (finished) in
SVProgressHUD.dismiss()
}
But same syntax not working with Swift3.
Also try by creating function with closure.
func greetingMessageWithDate(date : NSDate, message :String, successHandler : (greetingMessage : String, code : Int ) -> Void){
}
Same function working in Swift 2.2, but not in Swift 3
Also facing issue with SDWebImage
completion block.
I am able to use SDWebImage
without completion handler, but with completion handler it fails.
Works without completion handler.
imageView.sd_setImage(with: URL(string: "imageURL"), placeholderImage: UIImage(named : "imageName"))
But when using with completion handler, compiler complains with given message.
Ambiguous use of 'sd_setImage(with:placeholderImage:completed:)'
imageView.sd_setImage(with: url, placeholderImage: UIImage(named: "imageName"), completed: { (image, error , cacheType , imageURL) in
})
It looks like, change would be in closure syntax, but how to find that What is going wrong ?