Dux
Dux copied to clipboard
Question: Is there a way to apply tab to a tab bar Item?
How can we highlight the center tab in a TabView to show the tip on top of it?
Sharing the current workaround I used to place a fake view on top of the tab bar item if it helps someone.
The width of the view is determined by dividing the screen width by the number of tabs and the height is determined by gReader.safeAreaInsets.bottom
fakeLearnTabItemView(for: gReader.safeAreaInsets.bottom)
.position(x: gReader.frame(in: .local).midX, y: gReader.frame(in: .local).maxY + (gReader.safeAreaInsets.bottom / 2))
private func fakeLearnTabItemView(for height: CGFloat) -> some View {
HStack {
Spacer()
Color.clear.frame(width: UIScreen.main.bounds.size.width/3, height: height, alignment: .bottom)
.duxTag(Tags.learn)
Spacer()
}
.frame(alignment: .bottom)
}
Thanks for sharing the workaround! I think something like this is the best way to do it right now, but there should be better support for this in the library. Will look into more when I can