I want to achieve such a control like this (https://github.com/Yalantis/Segmentio) in SwiftUI (but without image):
What would be the best approach?
Should I use a segmented control and customize it, like text in the middle and a bottom border?
Or should I use a ScrollView-->HStack-->XButtons?
This I already tried, but how should i animate the bottom border on selection change? Is something possible in SwiftUI?
ScrollView(.horizontal) {
HStack(alignment: .center, spacing: 8, content: {
Button(action: {
print("Button pressed")
}, label: {
Text("Example Button")
.padding(20)
})
... button 2, ... button 3 and so on
}).frame(height: 80, alignment: .leading)
}