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?
Post
Replies
Boosts
Views
Activity
I would like to split my free app into smaller parts so the download size is smaller. But I read somewhere that On Demand Resources are for in-app purchases only.
Can I use On Demand Resources in my free app?
How do I customize my app's startup experience when using DocumentGroup in SwiftUI with SwiftData?
I don't want my users to be greeted with a document browser on startup.
Rather, I want to offer an experience like PhotoShop where the user is greeted by an "empty" version of my app's editor view. They can then use something like File->New or File->Open to get started.