It appears I can't add a WebP image as an Image Set in an Asset Catalog. Is that correct?
As a workaround, I added the WebP image as a Data Set. I'm then loading it as a CGImage with the following code:
guard let asset = NSDataAsset(name: imageName),
let imageSource = CGImageSourceCreateWithData(asset.data as CFData, nil),
let image = CGImageSourceCreateImageAtIndex(imageSource, 0, nil)
else {
return nil
}
// Use image
Is it fine to store and load WebP images in this way? If not, then what's best practice?