AGENT SKILL

ios26-toolbar-leading-title-truncation

A SwiftUI screen title placed in ToolbarItem(placement .topBarLeading) renders on iOS 26 as a single letter plus ellipsis ("C…") inside a small glassy circle/capsule, instead of the full title text — happens with .navigationBarTitleDisplayMode(.inline) and a custom Text (especially large/serif font) in a leading or trailing toolbar slot. Use when a title looks truncated-to-one-glyph in a Liquid Glass toolbar button on iOS 26, when deciding where to put a screen title that also needs an adjacent action button, or when tempted to move a title out of .navigationTitle into a ToolbarItem for layout control.

License 许可
MIT
最近更新
2026-11-07
Stars
★ 1
Forks
1

01 前言 Front Matter

name
ios26-toolbar-leading-title-truncation
description
A SwiftUI screen title placed in ToolbarItem(placement .topBarLeading) renders on iOS 26 as a single letter plus ellipsis ("C…") inside a small glassy circle/capsule, instead of the full title text — happens with .navigationBarTitleDisplayMode(.inline) and a custom Text (especially large/serif font) in a leading or trailing toolbar slot. Use when a title looks truncated-to-one-glyph in a Liquid Glass toolbar button on iOS 26, when deciding where to put a screen title that also needs an adjacent action button, or when tempted to move a title out of .navigationTitle into a ToolbarItem for layout control.

03 SKILL.md 正文

iOS 26 Toolbar Leading/Trailing Title Truncates to One Glyph

Symptom

A custom title Text placed in ToolbarItem(placement: .topBarLeading) (or .topBarTrailing) renders on iOS 26 as just its first character followed by an ellipsis, e.g. "Cubby" → "C…", inside a small glass capsule/circle. This happens even though the same title works fine as .navigationTitle, and even though short symbols (+, xmark) in other toolbar slots render correctly. .navigationBarTitleDisplayMode(.inline) is typically set to keep the bar thin. The bug reads like a font or Dynamic Type problem but isn't — it reproduces at default text sizes with any sufficiently wide title.

Root cause

A leading/trailing toolbar item is a compact bar-button placement — sized and Liquid-Glass-wrapped for an icon or a one-to-two-character label, not a free-form title. .navigationTitle is laid out and scaled by the system (it owns truncation/scaling behavior for the nav bar); a ToolbarItem slot is not — it treats its content like a button label and clips it hard once it overflows the capsule, degenerating to first-glyph-plus-ellipsis. Wide or serif fonts overflow the slot faster, making this easy to trigger with a branded/large title font specifically. The failure is placement-specific, not font-specific: any title long enough to exceed the compact bar-button width will do this.

Fix

Don't put a screen title in a toolbar item at all. Render it as an in-content header row at the top of the scrollable content instead, and keep .navigationBarTitleDisplayMode(.inline) with an empty system title so the nav bar stays thin. This also gives you a natural home for a trailing action button on the same row as the title.

// WRONG — title text in a bar-button placement; iOS 26 clips to "C…"
// inside a glass capsule once the title is wider than a compact button.
.toolbar {
    ToolbarItem(placement: .topBarLeading) {
        Text("Cubby").font(.largeTitle.bold())
    }
}
// CORRECT — title rendered in content, not in a toolbar slot.
struct ScreenHeader<Trailing: View>: View {
    let title: String
    let trailing: Trailing

    init(title: String, @ViewBuilder trailing: () -> Trailing) {
        self.title = title
        self.trailing = trailing()
    }

    var body: some View {
        HStack(alignment: .firstTextBaseline) {
            Text(title)
                .font(.title.bold())
                .accessibilityAddTraits(.isHeader)
            Spacer(minLength: 8)
            trailing   // e.g. a "+" quick-add button, same row as the title
        }
    }
}

extension ScreenHeader where Trailing == EmptyView {
    init(title: String) { self.init(title: title) { EmptyView() } }
}

// In the screen:
// .navigationBarTitleDisplayMode(.inline)   // keep the system title empty/thin
// ScrollView { ScreenHeader(title: "Cubby") { addButton }; ... }

Toolbar slots remain fine for genuinely short content — single glyphs, SF Symbols, one- or two-character labels. The trap is specifically a title (long text, custom/large font) placed in a bar-button placement.

Evidence

  • cubby — a branded serif "Cubby" title in ToolbarItem(.topBarLeading) rendered as "C…" in a glass circle on iOS 26; fixed by replacing it with an in-content ScreenHeader row and keeping .navigationBarTitleDisplayMode(.inline) for a thin, title-less system bar.

Related skills

  • mainactor-runtime-isolation-trap — unrelated failure class (runtime actor isolation crashes/re-entrancy), not a layout issue; don't confuse "compiles clean but misbehaves at runtime" framing across the two.

04 同仓库更多 Skills

abhijitbansal
abhijitbansal/claude-skills

second-wind

Orchestrate long unattended Claude Code runs across multiple repos with the wind CLI. Use when the user wants to run Claude Code overnight, resume sessions after the 5-hour usage limit, run Claude in many repos at once via tmux, or says "set up second wind", "wind up", "overnight run", "resume after limit", "usage limit orchestrator".

★ 1
abhijitbansal
abhijitbansal/claude-skills

structured-output-adaptive-thinking-token-bloat

A Claude API call using output_config.format (json_schema structured outputs) with thinking:{type:"adaptive"} burns most of its output budget on thinking (observed ~21k of ~24k tokens) without improving JSON quality, making the run up to ~5x more expensive than the same call with thinking omitted — use when calling the Messages API with a json_schema output format for extraction, ranking, classification, or summarization tasks, or when a schema-constrained call's usage.output_tokens is far larger than the returned JSON.

★ 1
abhijitbansal
abhijitbansal/claude-skills

review

Apply a code-review lens to a diff, branch, or file — find correctness bugs, security issues, and quality problems, ranked by severity, with a concrete fix for each. Use when the user says "review this", "review my diff", "check this PR", "look this over before I commit", or "is this safe". Skip when the user wants the code written, not reviewed.

★ 1
abhijitbansal
abhijitbansal/claude-skills

refresh

Rebuild the prompt-craft command registry and usage profile, and print a summary of installed commands and your personalized recommendations. Use when you install or update plugins and want the advisor to pick them up immediately, or say "refresh prompt-craft", "rebuild the command registry".

★ 1
abhijitbansal
abhijitbansal/claude-skills

refactor

Apply a refactoring lens — restructure code without changing behavior, guarded by tests that pass before and after. Use when the user says "refactor", "clean this up", "extract this", "simplify this", "reduce duplication", or "make this readable" on existing working code. Skip when the change is meant to alter behavior (that's a feature or a fix).

★ 1
abhijitbansal
abhijitbansal/claude-skills

plan

Decompose a non-trivial task into an explicit, tracked plan with goals and per-step acceptance criteria before writing code. Use when the user says "plan this", "break this down", "what's the plan", or asks for a multi-step feature/refactor that touches more than one file. Pairs with plan mode. Skip for single-edit changes that need no decomposition.

★ 1