audit-swiftui-drawing-canvas

Audits macOS SwiftUI drawing and Canvas code for API misuse, availability gating, and architecture defects.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Custom drawing code in macOS SwiftUI apps often misuses core APIs: dozens of stacked views where one Canvas belongs, Timer-driven redraw loops instead of TimelineView, GeometryReader abused as a layout container, and ungated MeshGradient calls below the macOS 15 floor. This Skill systematically detects and reports these defects in an existing project. ## Core Features & Use Cases - 12-Rule Defect Index: Detects draw-01 through draw-12, covering Canvas consolidation, Timer redraw loops, GeometryReader-as-layout, hard-coded frames, MeshGradient gating and arity, Path math smells, drawingGroup misuse, and missing accessibility descriptors. - Hybrid Lint Engine: Runs tier-1 ripgrep tells plus tier-2 ast-grep structural rules (ungated MeshGradient, GeometryReader arranging children, Timer redraw loops) with JSON and SARIF output. - Evidence-Backed Verification: Cross-checks every uncertain finding against a corpus of 1,857 real macOS apps via the swiftui-ctx CLI and Apple documentation via Sosumi before reporting. - Use Case: Point it at a macOS SwiftUI project with a custom chart or particle animation; it locates the Timer-plus-State redraw loop, confirms TimelineView is the correct replacement, and writes a structured finding with a permalinked real-world example. ## Quick Start Audit the SwiftUI drawing and Canvas code in my macOS project and report any defects with fixes.

Frequently Asked Questions about audit-swiftui-drawing-canvas

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

FAQPage Schema
How do I audit SwiftUI Canvas and drawing code on macOS?

Run the shared lint runner with this skill's rule set against your SwiftUI sources, then read each located file in full. The skill detects 12 defect types including Timer redraw loops, ungated MeshGradient, and GeometryReader-as-layout, and writes structured findings to swiftui-audits/drawing-canvas/.

When should I use Canvas instead of multiple SwiftUI views?

Use one Canvas for bulk static or procedurally drawn paint with no per-element identity, since it renders everything in a single immediate-mode pass. Keep individual views only for elements that are interactive or independently identified, such as those with their own gestures or accessibility nodes.

Does MeshGradient require availability gating on macOS?

MeshGradient requires macOS 15.0 or later, so it must be wrapped in if #available(macOS 15, *) when the deployment target is below macOS 15. Gating it on the iOS arm in a macOS target is a hard-fail defect the skill auto-fixes.

Why is a Timer driving SwiftUI redraws a problem?

A Timer mutating @State to force re-rendering is a manual render loop that is not vsync-aligned and churns the whole view body. TimelineView with an .animation, .periodic, or .explicit schedule redraws on a proper cadence and hands you a context.date to derive each frame.

What are the limitations of this drawing audit?

It is audit-only and never generates drawing code from scratch, and it is restricted to macOS SwiftUI. Only the wrong-arm availability gate is auto-fixed; all other findings are flag-only because architecture and judgment calls require human review.