3

How can I customize the native navigation bar in SwiftUI to resemble the one used in the Apple TV app for iOS? On the detail screen, there's a native navigation bar where the tint color of the toolbar button item and the navigation bar background change when scrolling.

I'm aware that I can replicate the same behavior by using a ZStack and a custom navigation bar, along with a GeometryReader to adjust the opacity. However, I'd like to achieve this using the native navigation bar and toolbar so that I can take advantage of all the built-in animations.

I've attempted to modify the color using .toolbarBackground(.gray.opacity(0.5), for: .navigationBar), but even when the opacity is set to 0, the color isn't completely clear. Also, how can I animate the color change during scrolling?

Detail screen with background image and white color Tool bar items with Blur circle background

Detail screen with white navigation bar when scroll down to content

Yatheesha
  • 10,412
  • 5
  • 42
  • 45
  • Have you tried creating your own custom toolbar, and then setting its background color to clear? Like, literally `.background(Color.clear)`? – kiselitza Mar 30 '23 at 11:58

0 Answers0