79836579

Date: 2025-12-03 06:27:36
Score: 0.5
Natty:
Report link

Instead of using .navigationBarTitle(), remove that modifier and add the title text inside the toolbar using .toolbar(.topLeading) — then match the styling to replicate the original appearance.

Sample code

import SwiftUI

struct Practice: View {
    var body: some View {
        NavigationStack {
            List(1..<101) { i in
                Text(String(i)).font(.title)
            }
            .contentMargins(.top, 0.0) // this removes top padding in list
//            .navigationTitle("Title")
//            .navigationSubtitle("Hello Swift")
            .toolbar {
                ToolbarItem(placement: .topBarLeading) {
                    Text("Title")
                        .font(.largeTitle.bold()) // Same style as navigation title
                }
                ToolbarItem(placement: .topBarTrailing) {
                    Image(systemName: "applelogo")
                }
            }
//            .toolbarTitleDisplayMode(.inlineLarge)
        }
    }
}

#Preview {
    Practice()
}

sample screenshot

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Pramod