'SwiftUI how to force a divider for navigation bar in NavigationView

My app has simple navigation logic using navigation view. I use the inline style navigation bar:

mainView
  .navigationBarTitleDisplayMode(.inline)

I notice that the navigation bar's divider is missing for the root view. And it appears when I scroll up the content a bit.

This first screenshot shows the initial state (without nav bar divider):

enter image description here

This second screenshot shows the state when I scroll up the content a bit, and it shows nav bar divider:

enter image description here

Is it possible to always show the divider without scrolling?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source