Open tanlucvo opened 2 years ago
I try with this image https://ibb.co/bBjrHtG
Hi! I will check soon
Thank you
@tanlucvo show how u use Nuke and NukeWebP to download and show image
Does it work with simple gif?
wait for related task https://github.com/kean/Nuke/pull/615
@tanlucvo show how u use Nuke and NukeWebP to download and show image
Yupp, here is my code. It seem not working with GIF
import UIKit
import Nuke
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
WebPImageDecoder.enable(closure: {
var options = WebPDecoderOptions()
options.useThreads = true
return AdvancedWebPDecoder(options: options)
})
let view = AsyncImageView(frame: CGRect(x: 100, y: 100, width: 100, height: 100))
self.view.addSubview(view)
}
}
final class AsyncImageView: UIImageView, ImageTaskDelegate {
private var imageTask: ImageTask?
private var pipeline: ImagePipeline = ImagePipeline {
$0.dataCache = try? DataCache(name: "com.myapp.datacache")
$0.dataCachePolicy = .automatic
}
override init(frame: CGRect) {
super.init(frame: frame)
Task{
try? await loadImage()
}
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
func loadImage() async throws {
self.image = try await pipeline.image(for: URL(string: "https://i.ibb.co/7SPsJNB/usagyuuun-tang-dong-8.gif")!, delegate: self).image
}
func imageTaskCreated(_ task: ImageTask) {
self.imageTask = task
}
}
Hi! I will check soon