I'm trying to implement a Gridview with photos stored in the photos app so the user can choose one picture and pick that as his profile picture. Before SwiftUI I used the collection view and Photos Kit to fetch the images and display them in a grid.
Now that I switched to SwiftUI I tried to use LazyVGrid. I am able to fetch all the photos of the user and display them in a Grid. However it uses a lot of memory. I had a memory leak before but now Instruments isn't showing any leak any more.
I thought it may be, that the Grid isn't really unloading the displayed images, when it gets invisible to the user. However if you scroll up and down multiple times it just uses a lot more memory than before. Like the grid is creating always new views and the old ones don't get deleted. Am I using something wrong or misunderstand the principles of LazyVGrid?