I am playing around with Zstack to show the list of images(stacked tinder like view) from the users iphone album. There are photos landscape and in portrait mode. When stacked if the 1st image seems to be landscape mode I still can see the background images.
Is there a way to hide the background images until they are brought to foreground through gestures?
struct ContentView: View {
@StateObject var viewModel = MediaApiViewModel()
var body: some View {
VStack {
ZStack{
ForEach(viewModel.allPhotos, id: \.identifier) { photo in
GeometryReader { geometry in
photo.view { image in image.resizable().aspectRatio(contentMode: .fit) }
.frame(maxWidth: geometry.size.width,
maxHeight: geometry.size.height)
.clipped()
}
}
}
}
}
}
Note: Using a library MediaSwiftUI which gives me a view on the photo object.