|
Hi, I have an Horizontal Scroll View which displays 3 cards, below it I have a list of related infos. When scrolling the cards, how can I detect which card is currently displayed on screen in order to show the related and correct infos? Thanks |
|
I added a tap gesture on the card so, when I click one, it automatically updates the list with the relevant infos. But I can't figure it out how to detect which card is currently on screen. Maybe I have to calculate it using geometry reader or similar? Any suggestion? Thanks |
|
Hi! Maybe as an easier option for you to use TabView like so.
Well if it fits your purpose and design of course... |
|
If you still need to use ScrollView here is a good example. A bit verbose piece of code though... Credits to Daniel Saidi, cannot post link. Seems like too many spammers so HWS rejects insertion of some links now...
|
|
Thank you so much! I think the TabView solution is more natural using SwiftUI, it makes the code more easier and readable. |
SAVE 50% All our books and bundles are half price for Black Friday, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.