JWAutumn/ACarousel

Any way to run a closure when an item is the primary one shown?

t9mike opened this issue · 2 comments

Cool view. Thanks for sharing!

I would like to use ACarousel to select an item, but the button is not an item view, it is a fixed button.

So running a closure when the primary item is moved would be helpful.

I was able to make viewModel.activeIndex public and then access this in my button's handler. This seems to return the right offscreen index so I did:

                    var i = carousel.viewModel.activeIndex - 1
                    if (i < 0)
                    {
                        i = items.count-1
                    }

To map this back to my data.

I somehow missed the index binding option. Apologies.