Post

Replies

Boosts

Views

Activity

Customize DocumentGroup in SwiftUI with SwiftData
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.
1
1
1k
Jun ’23
WebP image in Asset Catalog?
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?
0
0
1.3k
Oct ’23