How to add view below navigation bar to extend scroll edge effect

Hello! What UIKit API enables you to add a view below the navigation bar and extend the scroll edge effect below it in iOS 26? safeAreaBar is how you do it in SwiftUI but I need to achieve this design in my UIKit app (which has a collection view in a view controller in a navigation controller).

struct ContentView: View {
    let segments = ["First", "Second", "Third"]
    @State private var selectedSegment = "First"
    
    var body: some View {
        NavigationStack {
            List(0..<50, id: \.self) { i in
                Text("Row \(i + 1)")
            }
            .safeAreaBar(edge: .top) {
                Picker("Segment", selection: $selectedSegment) {
                    ForEach(segments, id: \.self) {
                        Text($0)
                    }
                }
                .pickerStyle(.segmented)
                .padding(.horizontal)
                .padding(.bottom, 8)
            }
            .navigationTitle("Title")
            .navigationBarTitleDisplayMode(.inline)
        }
    }
}

Answered by anils in 867572022
Accepted Answer

That does work thanks! Adding that to the container view of the segmented control seamlessly blends the scroll edge effect across both the navigation bar and custom "bar."

That does work thanks! Adding that to the container view of the segmented control seamlessly blends the scroll edge effect across both the navigation bar and custom "bar."

Hello! In my case, everything works but not as expected.

The edge effect only applies around segmentedControl and looks like a shadow. However, if I hide navigationBar, effect extends to the entire width.

Could you help me figure out what I'm doing wrong and how to implement this behavior correctly?

Thank you!

How to add view below navigation bar to extend scroll edge effect
 
 
Q