HomeiOS DevelopmentSwiftUI, iOS 26.2, ToolbarItem .largeTitle and .title, overlap concern

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


I constructed this quite simple instance to reveal the problem im dealing with 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 screen()
                .navigationTitle("First")
                .toolbar {
                    ToolbarItem(placement: .largeTitle) {
                        Textual content("First")
                            .font(.largeTitle)
                            .border(Colour.black)
                    }
                }
                .navigationDestination(for: Int.self) { integer in
                    DestinationScreen(integer: integer)
                }
        }
    }
}

struct Display screen: 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(Colour.black)
            }
        }
    }
}

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

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 big 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 identified established behaviours, and .largeTitle ought to be main aligned.
  • One other concern 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 big 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

- Advertisment -
Google search engine

Most Popular

Recent Comments