When I pop from a pushed view that has a display mode of inline the display mode of the parent view which was originally large is changed to inline and the user has to scroll down for the title to revert back to its original mode.
Q: How do I ensure that large title on the settings view is always showing?
I am using Xcode 14 beta 6 and in the preview it does not happen however on the simulator running iOS 16 it occurs.
SettingsView
struct SettingsView: View {
@State private var isPresentingChangePasswordView = false
var body: some View {
Form {
Section {
NavigationLink(destination: EmptyView()) {
Label("Account Details", systemImage: "person")
}
NavigationLink {
Form {
Button("Change Password") {
isPresentingChangePasswordView = true
}
}
.navigationTitle("Password & Security")
.navigationBarTitleDisplayMode(.inline)
} label: {
Label("Password & Security", systemImage: "lock")
}
NavigationLink(destination: EmptyView()) {
Label("Manage Subscription", systemImage: "crown")
}
Button {
} label: {
HStack {
Label {
Text("Sign Out")
.foregroundColor(.black)
} icon: {
Image(systemName: "rectangle.portrait.and.arrow.right")
}
Spacer()
Image(systemName: "chevron.forward")
.foregroundColor(Color(red: 191/255, green: 191/255, blue: 191/255))
.fontWeight(.semibold)
.imageScale(.small)
}
}
} header: {
Text("Your account")
}
}
.navigationTitle("Settings")
.navigationBarTitleDisplayMode(.large)
.sheet(isPresented: $isPresentingChangePasswordView) {
ChangePasswordView()
}
}
}
HomeView
struct HomeView: View {
var body: some View {
NavigationStack {
Text("HomeView")
.toolbar {
NavigationLink(destination: SettingsView()) {
Image(systemName: "gearshape")
.foregroundColor(.gray)
}
}
.navigationTitle("Home")
}
}
}
Update #1
When replacing the NavigationStack with a NavigationView it works exactly how I want to to work. While this is what I am looking for I would not consider it the answer as Apple have announced the NavigationView will deprecated as of iOS 16.