I'm using WebCache with swift.
When I set String into sd_setImageWithURL directly like following, it's displayed correctly.
imageView?.sd_setImageWithURL(NSURL(string: "http://imgfp.hotp.jp/IMGH/86/49/P018678649/P018678649_238.jpg"), placeholderImage: nil, options: SDWebImageOptions.CacheMemoryOnly, completed: {[unowned self] (image: UIImage!, error: NSError!, type: SDImageCacheType, url: NSURL!) -> Void in
....
But, I set like following, it's not displayed..
if let imageURL:String = shop.img {
print(imageURL) // same as above
self.imageView?.sd_setImageWithURL(NSURL(string: imageURL), placeholderImage: nil, options: SDWebImageOptions.CacheMemoryOnly, completed: {[unowned self] (image: UIImage!, error: NSError!, type: SDImageCacheType, url: NSURL!) -> Void in
....
}
What's wrong??
It's very simple:
if let strImage = "http://imgfp.hotp.jp/IMGH/86/49/P018678649/P018678649_238.jpg"{
self.imageView.sd_setImageWithURL(NSURL(string: strImage), completed: { (img, error, type, urls) in
})
}
Use imageView.image to display wherever you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With