https://github.com/rs/SDWebImage
Step :1
Install pod 'SDWebImage', '~>3.8'
Step:2
let url = NSURL(string: userdetail.valueForKey("profile") as! String)
let placeHolderImage = UIImage.gifWithName("loading165-92")
profileimg.sd_setImageWithURL(url, placeholderImage:placeHolderImage, completed: { (image, error, cacheType, url) -> Void in
if (cacheType == SDImageCacheType.None && image != nil) {
self.profileimg.alpha = 0;
UIView.animateWithDuration(0.0, animations: { () -> Void in
self.profileimg.alpha = 1
})
} else {
self.profileimg.alpha = 1;
}
})
profileimg.layer.cornerRadius=profileimg.frame.size.width/2
profileimg.clipsToBounds=true
***************************************
Step :1
Install pod 'SDWebImage', '~>3.8'
Step:2
import SDWebImage
let url = NSURL(string: userdetail.valueForKey("profile") as! String)
let placeHolderImage = UIImage.gifWithName("loading165-92")
profileimg.sd_setImageWithURL(url, placeholderImage:placeHolderImage, completed: { (image, error, cacheType, url) -> Void in
if (cacheType == SDImageCacheType.None && image != nil) {
self.profileimg.alpha = 0;
UIView.animateWithDuration(0.0, animations: { () -> Void in
self.profileimg.alpha = 1
})
} else {
self.profileimg.alpha = 1;
}
})
profileimg.layer.cornerRadius=profileimg.frame.size.width/2
profileimg.clipsToBounds=true
***************************************
let SUBcat_image = UIImageView()
SUBcat_image.isUserInteractionEnabled=true
SUBcat_image.frame=CGRect(x: 5,y: 0,width: WidthofIMG,height: WidthofIMG)
let url = NSURL(string: (self.searcharr.object(at: subcat) as AnyObject).value(forKey: "subcat_image") as! String)
let placeHolderImage = UIImage.sd_animatedGIFNamed("100X100")
SUBcat_image.sd_setImage(with: url as URL!, placeholderImage:placeHolderImage, completed: { (image, error, cacheType, url) -> Void in
if (cacheType == SDImageCacheType.none && image != nil) {
SUBcat_image.alpha = 0;
UIView.animate(withDuration: 0.0, animations: { () -> Void in
SUBcat_image.alpha = 1
})
} else {
SUBcat_image.alpha = 1;
}
})
Sub_cointain_View.addSubview(SUBcat_image)
****https://stackoverflow.com/questions/38949214/ambiguous-use-of-sd-setimagewithplaceholderimagecompleted-with-swift-3****