let webpURL = URL(string: "https://mathiasbynens.be/demo/animated-webp-supported.webp")! let data = try! Data(contentsOf: webpURL) let cgimgsrc = CGImageSourceCreateWithData(data as CFData, nil)! let images = (0...CGImageSourceGetCount(cgimgsrc)).compactMap{ CGImageSourceCreateImageAtIndex(cgimgsrc, $0, nil) }.map{ UIImage(cgImage: $0) } imageView.animationImages = images imageView.startAnimating()