|
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. |
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.