How can I access the index
within the carousel?
#70
-
I'd like to display the typical dot indicators in the carousel, but I think I'd need the index to be able to indicate the current item. I've looked at the docs and examples and can't seem to figure it out unfortunately |
Beta Was this translation helpful? Give feedback.
Answered by
austinmrobinson
Jun 9, 2023
Replies: 1 comment 1 reply
-
I figured it out by creating an index variable .onCarousel { context in
carouselIndex = context.index
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
austinmrobinson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I figured it out by creating an index variable
@State var carouselIndex: Int
and setting it withinonCarousel