'SwiftUI NavigationView title principal item partially obscured after return from subView
I'm trying to use a VStack with two Text items for a centred title. It looks something like this:
When I go to a subView and then return, it looks the same for a moment but then an obscuring bar appears across the top of the upper Text item like this:
This code demonstrates the problem.
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink("Go to Second View", destination: SecondView())
.toolbar {
ToolbarItem(placement: .principal) {
VStack {
Text("Title Title Title").font(.title).bold()
Text("Subtitle").font(.subheadline).padding(.bottom)
}
}
}
}.navigationBarTitleDisplayMode(.inline)
}
}
struct SecondView: View {
var body: some View {
Text("Second View")
}
}
I've tried moving the .displayMode around and tried the different modes but I want to keep the NavigationView as the more compact .inline version. Short of a solution I'll have to rethink, thanks.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


