|
I am trying to increase the performance of my SwiftData app. I have a class that contains as follows:
When loading a LazyGrid and displaying the various cards, I would like to use AsyncImage to increase the performance when there are a lot of GreetingCards, I believe the approch would be to load all the columns except for cardFront, and then somehow have cardFront be loaded in the AsyncImageView I created. But I can't seem to figure out how to load a subset of columns in the initial Fetch for the LazyGrid. Is this possible? |
|
I found the following in SwiftData by Example (also here - https://www.hackingwithswift.com/quick-start/swiftdata/how-to-create-a-custom-fetchdescriptor):
Which seems to imply that I could load my LazyVGrid with just the Names of the events
I am not sure how I can use this FetchDescriptor with a Query. Right now in the Init for the above code, I create a Query and assign the results to an array of Cards. Can you add a fetchDescriptor to the query somehow?
But I am thinking this will not address the issue in ScreenView where I am trying to do the AsyncImage
I am still not sure how to have the card.eventType.eventName, and card.cardDate load immediately and then the card.cardFront?.cardFront load Async |
|
SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.