AGENT SKILL

swiftui-pushed-list-tabbar-scroll-clearance

A custom bottom tab bar (attached via safeAreaInset to a pager/root container, not per-screen) leaves the last row of a pushed List hidden or clipped behind it, even though pushed ScrollView screens clear it fine. Use this whenever a SwiftUI app has a hand-rolled tab bar (not the native TabView bar) and a pushed detail screen — especially a List — has content overlapping or hidden behind the bar, the last row is unreachable, or scrolling doesn't seem to go "all the way." This is a companion gotcha to the swiftui-tabbar-swipe-nav-tradeoff skill (custom pager + tab bar architecture) — read that skill first if the tab bar itself is a custom pager; this one is specifically about List's safe-area handling differing from ScrollView's.

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

01 前言 Front Matter

name
swiftui-pushed-list-tabbar-scroll-clearance
description
A custom bottom tab bar (attached via safeAreaInset to a pager/root container, not per-screen) leaves the last row of a pushed List hidden or clipped behind it, even though pushed ScrollView screens clear it fine. Use this whenever a SwiftUI app has a hand-rolled tab bar (not the native TabView bar) and a pushed detail screen — especially a List — has content overlapping or hidden behind the bar, the last row is unreachable, or scrolling doesn't seem to go "all the way." This is a companion gotcha to the swiftui-tabbar-swipe-nav-tradeoff skill (custom pager + tab bar architecture) — read that skill first if the tab bar itself is a custom pager; this one is specifically about List's safe-area handling differing from ScrollView's.
promotion_target
Append as "Part 3" to the ios-dev plugin's swiftui-tabbar-swipe-nav-tradeoff skill — same architecture family (custom pager-attached tab bar), different symptom (scroll clearance vs navigation race).

03 SKILL.md 正文

Custom Tab Bar + Pushed List — Last Row Clips Behind the Bar

Symptom

An app has a custom bottom tab bar attached via .safeAreaInset(edge: .bottom) to the pager/root container (not to each individual screen) so it stays visible over pushed detail screens. Pushed ScrollView-based screens already have an explicit clearance helper applied and scroll cleanly past the bar. A pushed List-based detail screen (BinDetailView, RackDetailView, or any List pushed onto the same NavigationStack) has its last row hidden or clipped behind the bar — the list appears to stop scrolling before reaching its real end, and a doc comment on the existing clearance helper may even claim this is expected ("List is exempt, it handles its own inset") — that claim is wrong.

Root cause

The bar's safeAreaInset is attached to the pager, one level up from any individual NavigationStack. A pushed screen's own scroll surface never receives that inset automatically — SwiftUI only auto-reserves the device safe area (the home indicator strip) for a List, not the extra height added by an app-level custom overlay bar that a NavigationStack push doesn't know about. A raw ScrollView has exactly the same gap, which is presumably why an explicit clearance helper already existed — but List was assumed (wrongly) to handle it via its own automatic inset behavior. It doesn't: List's automatic inset only ever covers the device's own safe area, never a custom in-app overlay.

Fix

Apply the same clearance helper to List-based pushed screens that ScrollView-based ones already use — there is no List-specific alternative needed, and no reason to special-case it:

extension View {
    /// Reserve bottom clearance for the paged root's custom tab bar on a
    /// **pushed** detail screen — List or raw ScrollView alike. The bar is
    /// attached to the pager, not each NavigationStack, so it stays visible
    /// over pushed screens and its safe-area inset doesn't reach a pushed
    /// screen's scroll surface; List's automatic inset only covers the device
    /// safe area, not this bar's added height. Apply to every pushed
    /// scrollable detail screen so its last content clears the bar. Single
    /// choke point so a new push destination can't silently forget it.
    func rootTabBarScrollClearance() -> some View {
        contentMargins(.bottom, RootTabBar.contentHeight, for: .scrollContent)
    }
}

// BinDetailView.swift / RackDetailView.swift — both List-based
List { ... }
    .scrollContentBackground(.hidden)
    .background(Theme.Palette.background)
    .rootTabBarScrollClearance()   // <- the fix; identical call as ScrollView screens

contentMargins(_:for:) works uniformly across List and ScrollView because both are backed by the same scroll-content machinery — there's no List-vs-ScrollView branching needed in the helper itself, only in remembering to call it on every pushed scrollable screen.

Verify by seeding enough rows to overflow one screen (an 11-item list, or whatever comfortably exceeds a device's visible height), reverting the fix temporarily to confirm the last row actually clips, then reapplying it and confirming the content clears the bar with no dead gap left over. Confirming the broken state first is what catches an insufficient fix (e.g., adding just enough clearance to help but not enough to fully clear).

The generalizable rule

Any time a custom overlay (tab bar, floating action button, banner) is attached at a container level above individual pushed screens rather than per-screen, assume its extra height reaches none of those pushed screens' own safe-area/inset handling automatically — regardless of whether the pushed screen is List, ScrollView, Form, or anything else backed by scrollable content. Route every pushed scrollable screen through one shared clearance helper (a single choke point) rather than hand-adding padding per screen, so a newly added push destination can't silently forget it — and don't trust a doc comment's claim that one content type is "exempt" without reverting the fix and reproducing the clip yourself first.

Related skills

  • swiftui-tabbar-swipe-nav-tradeoff — the parent architecture (custom pager + attached tab bar) that creates the pushed-content clearance gap in the first place; read that skill for the pager itself, this one for the scroll-content side effect once the pager exists.

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