audit-swiftui-view-performance

Audit macOS SwiftUI view rendering performance and fix mechanical defects.

2|1|Updated Jun 7, 2026
One-click install
npx skills add https://github.com/yigitkonur/plugin-swiftui --skill audit-swiftui-view-performance-yigitkonur
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: audit-swiftui-view-performance
Source: https://github.com/yigitkonur/plugin-swiftui/tree/main/plugins/swiftui/skills/audit-swiftui-view-performance
Command: npx skills add https://github.com/yigitkonur/plugin-swiftui --skill audit-swiftui-view-performance-yigitkonur

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ast-grep, and includes scripts (resource) and references (resource) components.

What problem does it solve? macOS SwiftUI apps accumulate rendering anti-patterns—formatters allocated inside body, identity churn from .id(UUID()), AnyView type-erasure, greedy GeometryReader, and per-render filter/sort in ForEach—that cause needless re-renders, especially in resizable, long-lived Mac windows. This Skill locates those defects with a hybrid lint engine, verifies them against real shipping-app code and Apple docs, and fixes the mechanical ones safely. ## Core Features & Use Cases - 12-rule defect index (vperf-01 to vperf-12): Detects heavyweight allocations in body/init, identity churn, un-skippable children, high-frequency @Environment fan-out, over-broad @Observable reads, eager ForEach, and leftover Self.printChanges() debug lines. - Hybrid lint engine: Runs tier-1 grep tells plus tier-2 ast-grep structural rules (formatter-inside-body, logic-in-init) with a per-file parse probe, emitting unified JSON and SARIF output. - Grounded fixes: Every suggested correction is backed by a consensus call shape from 1,857 real macOS apps via the swiftui-ctx CLI, plus Apple documentation fetched through Sosumi, with findings written to a unified on-disk schema. - Use Case: Point it at an in-progress macOS SwiftUI project; it locates a DateFormatter built inside body, confirms the Text(:format:) fix target against the deployment target, and writes a permalinked finding with the correct pattern. ## Quick Start Ask the agent to audit your macOS SwiftUI project's view performance and report findings with fixes.

Frequently Asked Questions about audit-swiftui-view-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find SwiftUI view performance problems in a macOS app?

Run the audit against your SwiftUI sources; it locates 12 defect classes including formatters in body, .id(UUID()), AnyView, and eager ForEach using grep plus ast-grep structural rules. Each located file is read in full before a finding is reported at 100% certainty.

How to detect why a SwiftUI view keeps re-rendering?

Drop Self._printChanges() as the first line of the suspect body; it prints which dependency caused re-evaluation. An @identity cause indicates identity churn, while an unexpected property name indicates over-broad @Observable observation.

Does the audit automatically fix the issues it finds?

Only two mechanical defects are auto-fixed: .id(UUID()) replaced with a stable identity and Self._printChanges() debug lines stripped. All other findings are flag-only with a grounded correct pattern, applied under a clean-tree fix-safety protocol with one commit per finding.

Is this audit limited to macOS SwiftUI projects?

Yes, it is macOS-only and SwiftUI-only, targeting defects that bite harder on resizable, long-lived Mac windows. It reads the project's MACOSX_DEPLOYMENT_TARGET to gate floored fix targets like Text(_:format:), which requires macOS 12.0 or later.

What happens when the lint engine cannot parse a Swift file?

The runner emits per-file parse warnings so a structural miss cannot masquerade as clean; flagged files must be read by hand. If ast-grep is unreachable, the engine degrades to grep-only with a notice.