Yalantis/Segmentio

How to change the SegmentioIndicatorOptions at runtime?

MMSApps opened this issue · 1 comments

Is it possible to change the SegmentioIndicatorOptions (the bottom line) of the segment at runtime?

I tried

 segmentioView.valueDidChange = { segmentio, index in
            self.segmentioView.setup(content: content, style: .onlyImage, options: options)
}

but nothing changes.
Thanks

rnkyr commented

Hello, @MMSApps!
Well, it's not a good solution to call setup method for any change since it rebuilds layout.
Nevertheless, it works for me. I just run the example project and changed lines 59-67 of ExampleViewController.swift file to

segmentioView.valueDidChange = { [unowned self] (_, _) in
            SegmentioBuilder.buildSegmentioView(
                segmentioView: self.segmentioView,
                segmentioStyle: SegmentioStyle.onlyImage
            )
        }

Please check it once again and if it doesn't work on your project try to run the example.
Let us know if you still have the issue.