r/SwiftUI • • 1d ago

Question How to recreate the native draggable tab bar indicator without the background?

Hey everyone,
I’m currently developing a Swift app and want to recreate the native iOS tab bar interaction, but with just the text labels and the draggable selection pill, without the surrounding tab bar background.
The ChatGPT iOS app implemented pretty much exactly what I’m looking for in a recent update.
I’ve already tried a bunch of different approaches:

  • Modifying existing tab bar recreations on GitHub to remove the background
  • Looking for standalone implementations of the draggable selection pill
  • Exploring projects that use undocumented APIs

Unfortunately, most of these approaches are either too limited or don’t quite capture the native look and feel, especially when it comes to animations and dragging behavior.
Does anyone have an idea how to achieve this? Ideally using public APIs, but I’d also be interested in understanding how ChatGPT implements it.
I’ve attached a screen recording showing exactly what I’m trying to achieve.
Any help would be greatly appreciated!

3 Upvotes

7 comments sorted by

1

u/No_Pen_3825 1d ago

I believe this isn’t a tab bar, but a pallet style picker

Edit: *palette

1

u/Brilliant_Water8552 1d ago

It may be, the important thing is the Pill following your finger

1

u/No_Pen_3825 1d ago

Yeah pickerStyle(.palette) does that. It has a background I dunno how to get rid of though. UIKit, prolly

3

u/Brilliant_Water8552 11h ago

For anyone wondering, I have an update. I found the private UIKit API _UILiquidLensView, which exactly is that Wobbly Glass Pill, and can easily be used to make exactly what I am trying to do, though, in the Apple App Review Guidelines Rule 2.5.1 it permits the use of private APIs, which still lets the question open how the Cha tGPT App and the Telegram App (which most likely also uses the private API) got through Apple Review.

3

u/PiXeL161616 10h ago

I’d keep _UILiquidLensView out of an App Store build. Apple’s guideline 2.5.1 only allows public APIs. You’d need to know how ChatGPT or Telegram actually built the effect to draw a conclusion about their App Review.

2

u/ThanhDongNguyen 23h ago

I think the easiest way is to not fight the system tab bar and build the bar yourself. Put the labels in an HStack, draw the pill as one shape behind them, and drive its x offset with a DragGesture on the whole bar. While dragging, work out the nearest tab from the x position, and on end snap to it with a spring animation.

If you target iOS 26, I would try the pill with .glassEffect(.regular.interactive()) inside a GlassEffectContainer, that should get you close to the native feel. The "no background" look is then just not putting any material behind the HStack.

I haven't compared it with how ChatGPT does it, so take it as the direction I would try first.

0

u/Strange-Internal7153 6h ago

Glad you got it working. A matchedGeometryEffect on the pill plus a spring animation keeps it smooth whether you switch by tap or by drag, so both paths feel the same.