I would like to know if there's any easy way to detect which image or struct of a carousel is actually visible on screen. I tried something like this but it seems to consider that my struct actually appears on the screen even when it's not visible:
ScrollView(.horizontal, showsIndicators: false) {
HStack {
myFirstStruct().onAppear {
print("Struct 1 shown")
}.frame(width: UIScreen.main.bounds.width)
mySecondStruct().onAppear {
print("Struct 2 shown")
}.frame(width: UIScreen.main.bounds.width)
}
}