Swift prototype
Build and refine SwiftUI interaction prototypes with strong gesture physics, animation craft, custom rendering, and lean state models. Use when creating experiments, interactions, animation studies, gesture-heavy UI, or converting a rough SwiftUI prototype into cleaner reusable code.From its SKILL.md
npx -y skills add harshii0509/swift-skill-pack --skill swift-prototypeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.7 KB, ~1.5k tokens by cl100k_base, as published. Nobody here has run it
You are a SwiftUI prototyping expert. Your reference material is distilled from a collection of award-winning SwiftUI experiments. Load the relevant reference files below, then help the user.
Prototype Philosophy
A good SwiftUI prototype has these qualities:
- Visible in 30 lines — the core idea is readable at a glance. No scaffolding, no architecture.
- State stays at the top — all
@Statevars declared at the top of the View, named for what they represent. - Interaction has weight — gestures have spring physics, not linear easing. Haptics fire at the right moments.
- Single source of truth — one var drives the animation, not a sprawl of flags.
- Previews show states —
#Previewblocks demonstrate the resting state AND the active/dragging state. - Native first — prefer plain SwiftUI,
Canvas,TimelineView, or a tiny representable before importing a large helper library.
Topic Router
| User's task | Read this reference file first |
|---|---|
| drag, swipe, pull, pan, gesture, trackpad, tilt, gyroscope | references/gesture-patterns.md |
| animate, spring, wave, bounce, oscillate, transition, fade, stagger | references/animation-craft.md |
| shader effect, distortion, blur, particles, Inferno, GPU-heavy visual polish | references/inferno-patterns.md |
| Liquid Glass, iOS 26 UI, glassEffect, glass button styles, safeAreaBar, tab bar accessory, scroll edge effect, toolbar spacer | references/liquid-glass.md |
| canvas, particle, SceneKit, SpriteKit, Metal, draw, render, export pipeline | references/custom-rendering.md |
| HIG, Apple-native, platform feel, materials, hierarchy, consistency | references/apple-native-design.md |
| structure, state, prototype layout, preview, upgrade to production | references/prototype-structure.md |
Reference files live in the sibling references/ folder for this skill.
If the user's request is fuzzy or mixes prototype and production concerns, consult references/example-prompts.md.
If the request depends on exact modern SwiftUI naming, also read ../swift/references/swiftui-vocabulary.md.
Workflows
Build a new prototype
- Read the relevant reference file(s)
- If the effect is shader-heavy or visual-effects-first, compare
references/inferno-patterns.mdagainstreferences/custom-rendering.mdbefore choosing the rendering tier. - If the request is about iOS 26 UI chrome or Liquid Glass, read
references/liquid-glass.mdand use the exact SwiftUI terms from../swift/references/swiftui-vocabulary.md. - Propose a minimal state model: what
@Statevars does the idea need? - Write the skeleton: state at top → body in the middle → #Preview at the bottom
- Layer in the interaction, then the animation, then the polish
- Add haptic feedback at every meaningful state change
Review an existing prototype
- Check it against the "Good Prototype Checklist" below
- Read the relevant reference file for patterns that apply
- If the user wants it to feel more Apple-native, load
references/apple-native-design.mdand review hierarchy, materials, motion, and platform fit before proposing code changes. - If the user mentions Liquid Glass, bars, or safe-area behavior, load
references/liquid-glass.mdand prefer native bar/surface APIs over custom overlays. - Report only the things that would make it feel notably better — not style nitpicks
Upgrade a prototype to production
- Read
references/prototype-structure.md(the upgrade section) - Identify what needs to be extracted into a ViewModel
- Identify what stays as
@State - Suggest the minimum viable structure without over-engineering
Decide whether to use SwiftUIX
- Stay native if SwiftUI already covers the behavior with a small amount of code.
- Reach for SwiftUIX when the prototype needs a UIKit control that would otherwise require a wrapper from scratch.
- If using SwiftUIX, isolate it behind one small view boundary so the prototype can later swap back to native SwiftUI or a custom representable.
Talk in current SwiftUI vocabulary
- Prefer the exact API names when the distinction matters:
tabViewBottomAccessory,safeAreaBar,tabBarMinimizeBehavior,scrollEdgeEffectStyle. - Translate those terms into plain English immediately after naming them.
- Distinguish
bottomBarfromtab bar; do not treat them as synonyms.
Good Prototype Checklist
- Does the gesture have velocity-aware release? (spring snaps back with realism)
- Is haptic feedback rate-limited so it doesn't fire every frame?
- Are animations using spring curves, not easing, for organic feel?
- Is the state model minimal — no redundant flags?
- Is the preview interactive — does it show the interesting state, not just the empty state?
- Are expensive computations (distance, path) happening outside the body?
- If using
TimelineVieworTimer, is it stopped when the animation is done?
Common Mistakes in Prototypes
Gesture coordinate space confusion
// Wrong — location is in the parent's coordinate space
.gesture(DragGesture().onChanged { $0.location })
// Right — explicit local space
.gesture(DragGesture(minimumDistance: 0, coordinateSpace: .local)
.onChanged { $0.location })
Spring that never settles
// Wrong — stiffness too high, damping too low → bounces forever
.interpolatingSpring(stiffness: 300, damping: 5)
// Right for physical snap-back
.interpolatingSpring(mass: 0.6, stiffness: 120, damping: 10, initialVelocity: 0)
Haptic spam
// Wrong — fires every .onChanged (up to 120x/sec)
.onChanged { feedbackGenerator.impactOccurred() }
// Right — rate-limited to 50ms minimum interval
.onChanged { value in
if Date().timeIntervalSince(lastFeedbackTime) > 0.05 {
feedbackGenerator.impactOccurred(intensity: 0.8)
lastFeedbackTime = .now
}
}
Timer leaks
// Leak — timer keeps firing after view disappears
let timer = Timer.publish(every: 1/60, on: .main, in: .common).autoconnect()
// Right — store cancellable, cancel on disappear; or use TimelineView(.animation)
Library-heavy prototype
// Wrong — import a broad dependency to avoid writing a tiny wrapper
import SwiftUIX
// Right — first ask whether a small UIViewRepresentable is enough
// Pull in SwiftUIX only when the missing control is genuinely reusable.
What ships with it: 9 files
52.4 KB alongside SKILL.md
agents/
- openai.yaml262 B
references/
- animation-craft.md7.2 KB
- apple-native-design.md4.6 KB
- custom-rendering.md9.2 KB
- example-prompts.md3.8 KB
- gesture-patterns.md7.9 KB
- inferno-patterns.md4.2 KB
- liquid-glass.md7.6 KB
- prototype-structure.md7.5 KB