check-swiftui-view
Skill4 starsChanged 19 days agoMITView on GitHub
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.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- local-stackSkill
- protocol-changeSkill
- releaseSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 57
Do not pass -parse-as-library: main.swift has top-level code.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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(oftenDesign/Theme.swift); - the
TontonCorefiles it needs (app/Sources/TontonCore/...).
Everything is compiled as one module, so remove the import TontonCore lines from the copies.
2. Write main.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
swiftc -O -o render *.swift && ./renderDo 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.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

