Swift图片下载缓存缩放库Maple Bacon

分享到:

Maple Bacon是一个用于iOS开发的图片下载、缓存、缩放Swift库。

使用MapleBacon

 

下载一张图片

The most straightforward way is theUIImageViewextension:

?
1 2 3 import MapleBacon … if let imageURL = NSURL(string: "…") {     imageView.setImageWithURL(imageURL) }

 

or with an optional closure, if you want to check for a possible error:

?
1 2 3 4 if let imageURL = NSURL(string: "…") {     imageView.setImageWithURL(imageURL) { (instance, error) in …     } }

 

Using the ImageManager directly

You can also access the underlying handler directly for more advanced usage:

?
1 2 3 4 5 if let imageURL = NSURL(string: "…") { let manager = ImageManager.sharedManager       manager.downloadImageAtURL(imageURL, completion: { (imageInstance, error) in …
昵    称:
验证码: