12.2 C
Canberra
Friday, January 23, 2026

SwiftUI, iOS 26.2, ToolbarItem .largeTitle and .title, overlap problem


I constructed this quite simple instance to display the problem im going through on iOS 26 when making an attempt to make use of customized ToolbarItem factor for .largeTitle.

Code:

struct ContentView: View {
    var physique: some View {
        NavigationStack {
            Display()
                .navigationTitle("First")
                .toolbar {
                    ToolbarItem(placement: .largeTitle) {
                        Textual content("First")
                            .font(.largeTitle)
                            .border(Coloration.black)
                    }
                }
                .navigationDestination(for: Int.self) { integer in
                    DestinationScreen(integer: integer)
                }
        }
    }
}

struct Display: View {
    var physique: some View {
        Record {
            ForEach(1..<50) { index in
                NavigationLink(worth: index) {
                    Textual content(index.description)
                        .font(.largeTitle)
                }
            }
        }
    }
}

struct DestinationScreen: View {
    let integer: Int
    
    var physique: some View {
        HStack {
            Textual content(integer.description)
                .font(.largeTitle)
            Spacer()
        }
        .padding()
        .navigationTitle(integer.description)
        .toolbar {
            ToolbarItem(placement: .largeTitle) {
                Textual content(integer.description)
                    .font(.largeTitle)
                    .border(Coloration.black)
            }
        }
    }
}

SwiftUI, iOS 26.2, ToolbarItem .largeTitle and .title, overlap problem

As proven on the gif, when navigating between pages, titles are going to overlap for a short time.

Different questions:

  • Why is it required for .navigationTitle() to exist (empty string would not work!) in order that the ToolbarItem .largeTitle can render in any respect?

    • If none is added, this ToolbarItem merely will not seem
  • Why is not the massive title naturally aligning to the main aspect?

    • Apple doc. would not point out any of this behaviour so far as I do know however typically these placement ought to replicate recognized established behaviours, and .largeTitle must be main aligned.
  • One other problem is proven on the picture beneath. When utilizing each .largeTitle and .title (to simulate the identical behaviour of transition between giant and inline title when scrolling), each will seem on the similar time. The massive title will disappear as you scroll down which is okay.

enter image description here

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

[td_block_social_counter facebook="tagdiv" twitter="tagdivofficial" youtube="tagdiv" style="style8 td-social-boxed td-social-font-icons" tdc_css="eyJhbGwiOnsibWFyZ2luLWJvdHRvbSI6IjM4IiwiZGlzcGxheSI6IiJ9LCJwb3J0cmFpdCI6eyJtYXJnaW4tYm90dG9tIjoiMzAiLCJkaXNwbGF5IjoiIn0sInBvcnRyYWl0X21heF93aWR0aCI6MTAxOCwicG9ydHJhaXRfbWluX3dpZHRoIjo3Njh9" custom_title="Stay Connected" block_template_id="td_block_template_8" f_header_font_family="712" f_header_font_transform="uppercase" f_header_font_weight="500" f_header_font_size="17" border_color="#dd3333"]
- Advertisement -spot_img

Latest Articles