Skip to content
Back to skills

Check Swiftui View

ASecurity

Render a SwiftUI view of the macOS app to a PNG at the notch's widths to check its layout, without launching the app. Use after changing a view in app/Sources/TontonClaude, before saying a UI change works.

  • 4 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 26, 2026
ai-agentsswiftapi

Works with

  • terminal
  • api

Security analysis

A100/100

Scanned October 26, 2026

npx -y skills add matteoepitech/tonton-claude --skill check-swiftui-view --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Check Swiftui View?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Check Swiftui View
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/matteoepitech-check-swiftui-view/badge)](https://www.skillsdirectory.com/skills/matteoepitech-check-swiftui-view)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: check-swiftui-view
description: Render a SwiftUI view of the macOS app to a PNG at the notch's widths to check its layout, without launching the app. Use after changing a view in app/Sources/TontonClaude, before saying a UI change works.
---

# Checking a SwiftUI view without the app

The notch only opens on hover, so a view change can't be seen from a terminal or in CI. Compile the view with a tiny
renderer and look at the image.

## 1. Gather the sources

Copy into a scratch directory, outside the repository:

- the view's file and every file it uses from `app/Sources/TontonClaude` (often `Design/Theme.swift`);
- the `TontonCore` files it needs (`app/Sources/TontonCore/...`).

Everything is compiled as one module, so remove the `import TontonCore` lines from the copies.

## 2. Write `main.swift`

```swift
import AppKit
import SwiftUI

@MainActor func render(width: CGFloat, to path: String) {
    let view = MyView(/* realistic sample data, including long strings */)
        .foregroundStyle(Theme.text)
        .frame(width: width, alignment: .leading)
        .padding(12)
        .background(Theme.bg)
        .environment(\.colorScheme, .dark)
    let renderer = ImageRenderer(content: view)
    renderer.scale = 2
    guard let tiff = renderer.nsImage?.tiffRepresentation,
        let png = NSBitmapImageRep(data: tiff)?.representation(using: .png, properties: [:])
    else { fatalError("render failed") }
    try? png.write(to: URL(fileURLWithPath: path))
}

MainActor.assumeIsolated {
    render(width: 380, to: "compact.png")
    render(width: 500, to: "standard.png")
}
```

The widths are those of the chat column for the Compact and Standard notch sizes (`NotchSizeChoice` in
`Settings/Preferences.swift`, minus the 236 pt session list and the padding). Use the full panel width for views outside
the chat.

## 3. Build, run, look

```sh
swiftc -O -o render *.swift && ./render
```

Do not pass `-parse-as-library`: `main.swift` has top-level code. Open the PNGs and check long text (wraps or truncates
on purpose), alignment and contrast on the dark background.

## Limits

`ImageRenderer` does not show hover states, animations, scrolling or the real notch window. Say in the PR that the view
was checked this way and not on screen.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.