swift-swiftui
Skill4 starsChanged 5 months agoMITView on GitHub
Swift 6+ and SwiftUI patterns for iOS/watchOS apps. MVVM architecture, animations, state management, accessibility, and Human Interface Guidelines. Use when building SwiftUI views, implementing MVVM with @Observable, or designing accessible HIG-compliant interfaces.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- Stijnus/dsh-rev-engtheir own version, first seen Nov 8, 2026
- daveebbelaar/bamatheir own version, first seen Nov 1, 2026
- pluginagentmarketplace/custom-plugin-swifttheir own version, first seen Dec 30, 2025
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- daveebbelaar/bama★ 1.7ksame name
- pluginagentmarketplace/custom-plugin-swift★ 9same name
- Stijnus/dsh-rev-eng★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository101 other files it gives its agents.
- ai-video-understandingSkill
- apple-foundation-modelsSkill
- arch-dddSkill
- arch-decision-recordsSkill
- arch-diagramsSkill
- arch-eventsSkill
- arch-mvp-roadmapSkill
- arch-python-modernSkill
- aws-app-runnerSkill
- aws-cicd-patternsSkill
- aws-security-hardeningSkill
- azure-functions-python-v2Skill
- azure-identity-m2m-authSkill
- azure-service-bus-messagingSkill
- azure-workflow-execution-modelsSkill
- caddy-tls-proxySkill
- compliance-frameworksSkill
- design-system-workflowSkill
- dev-debugging-strategiesSkill
- dev-standardsSkill
- docker-python-poetrySkill
- docker-pythonSkill
- fastapi-patternsSkill
- ffmpeg-laravel-videoSkill
- formik-yup-react-nativeSkill
- frontend-accessibilitySkill
- frontend-angular-aiSkill
- frontend-angularSkill
- frontend-angular-toolingSkill
- frontend-design-systemsSkill
- frontend-material-chatSkill
- frontend-material-design-3Skill
- frontend-svelteSkill
- gcp-cicd-patternsSkill
- gcp-cloud-runSkill
- gcp-cloudsql-infrastructureSkill
- gcp-finopsSkill
- gcp-observabilitySkill
- gcp-security-hardeningSkill
- github-actions-cicdSkill
- healthkit-biofeedbackSkill
- infra-terraformSkill
- ios-app-qualitySkill
- ios-audio-hapticsSkill
- jest-nestjs-testingSkill
- langchain-azure-openai-patternsSkill
- laravel-auth-hardeningSkill
- laravel-ci-mysqlSkill
- laravel-mix-webpackSkill
- laravel-modern-patternsSkill
- laravel-pint-patternsSkill
- laravel-s3-storageSkill
- laravel-sail-dockerSkill
- mobile-app-deploymentSkill
- mobile-e2e-testingSkill
- mobile-offline-syncSkill
- mobile-push-notificationsSkill
- mobile-video-uploadSkill
- mongodb-asyncmongoclient-patternsSkill
- mongodb-atlas-patternsSkill
- The first 60 shown.
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 36
Use Chart with LineMark, PointMark, BarMark for HRV trends and heart rate timelines.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Swift 6+ & SwiftUI
Modern Swift and SwiftUI patterns for iOS and watchOS application development.
When to Use
- Building iOS/watchOS UI with SwiftUI
- Architecting apps with MVVM
- Implementing animations, custom shapes, and data charts
- Designing accessible, HIG-compliant interfaces
- Configuring dark mode and adaptive colors
For Swift 6 concurrency patterns (actors, async/await, Sendable), see
swift-patterns-architecture. For navigation, DI, and project modularization, seeswift-app-structure.
MVVM with SwiftUI
@Observable ViewModel owned by @State in the View. Protocol-oriented abstractions (e.g., HealthServiceProtocol) enable testability and preview mocks.
Animations
SwiftUI's declarative animations with .animation(_:value:) for breathing circles, animatableData for custom Shape paths, and TimelineView for precise frame-rate timing.
Swift Charts
Use Chart with LineMark, PointMark, BarMark for HRV trends and heart rate timelines. Customize axes with AxisMarks, .chartYScale, and .chartYAxisLabel.
State Management Decision Tree
Need shared state across views?
├── Yes, simple value → @State + passing via init
├── Yes, complex object → @Observable class
├── Yes, across navigation → @Environment
├── Reactive stream from framework → AsyncStream + .task
└── Persistent data → SwiftData @ModelAccessibility
Dynamic Type support with .dynamicTypeSize(), Reduce Motion alternatives (static progress bar instead of animated circle), VoiceOver phase announcements via AccessibilityNotification.Announcement, and custom rotor actions for session control.
Reduce Motion for Animated Readouts
Circle().trim animations and Text + .contentTransition(.numericText()) that ignore @Environment(\.accessibilityReduceMotion) play motion for vestibular-disorder users — a HIG violation and an App Store review risk. When reduce motion is on, pass nil to .animation() (disables animation entirely) and .identity to .contentTransition() (crossfade instead of animating digits):
@Environment(\.accessibilityReduceMotion) private var reduceMotion
Circle()
.trim(from: 0, to: progress)
.animation(reduceMotion ? nil : .easeInOut(duration: 1.0), value: progress)
Text("\(score)")
.contentTransition(reduceMotion ? .identity : .numericText())Combined VoiceOver Labels
For grouped UI elements (signal pills, score + bucket + recommendation card), build the accessibilityLabel string in the same scope where the visible elements are built, from the same source data. Use .accessibilityElement(children: .combine) on the outer container. Drift is structurally impossible because both the label and the visible content consume the same input.
Dark Mode & Adaptive Colors
Define semantic colors in Asset Catalog with light/dark variants. Force .preferredColorScheme(.dark) during sessions for reduced visual stimulation. Use @Environment(\.colorScheme) for conditional rendering. Wellness palette: muted blues, teals, greens; avoid high-saturation reds.
Asset Management (Multi-Target)
When using companion app architecture (iOS + watchOS), named color sets in Assets.xcassets only resolve against the target's own resource catalog at runtime. Shared Swift code referencing Color("BrandPrimary") against a watchOS target whose catalog lacks the set silently falls back to default — the iOS and watchOS apps then visually diverge with no compile-time signal. A cp -R of the Colors directory during the build phase is the simplest approach. Same applies to image sets used in shared views.
Typography: Custom Fonts (iOS vs watchOS)
iOS: TTFs registered via UIAppFonts in Info.plist enable Font.custom("PostScriptName", size:). PostScript names differ from filenames — fc-scan or Python fonttools can verify them.
watchOS: Custom font registration is not supported (platform limitation). Font.system() is the only available option.
Shared font extension files split implementations with #if os(iOS) / #if os(watchOS). See examples.md for the conditional compilation pattern.
TimelineView Pitfalls
ScrollView + .animation() Interaction
Applying .animation(_:value:) to a ScrollView interferes with Button gesture recognition inside it — taps are consumed by the scroll gesture or cause scroll-to-top jumps. Scope .animation() to only the specific content that should animate, not the scroll container.
@State / @Observable Mutation in TimelineView Body
Mutating state during TimelineView's @ViewBuilder pass triggers "Modifying state during view update" — undefined behavior. Use a non-mutating snapshot(at:) -> (phase, progress) in the body; run mutating side-effects (stage advance, driver.update(now:)) in .onChange(of: context.date), which fires after the render pass. See reference.md § Pure-Snapshot Render for the full pattern and StageAdvanceController shape.
Anti-Patterns
| Anti-Pattern | Pattern |
@StateObject / @ObservedObject with iOS 17+ | Use @Observable + @State |
| Blocking main thread with synchronous HealthKit calls | Prefer async/await or AsyncStream for structured concurrency |
| Hardcoded frame sizes for animations | Use GeometryReader or relative sizing |
Skipping Sendable conformance on shared types | Mark all cross-actor types as Sendable |
| Force-unwrapping HealthKit authorization | Handle denial gracefully with fallback UI |
Hardcoded color literals (e.g., Color.blue) | Use Color asset catalog with light/dark variants |
| Building custom chart views with Canvas for standard data | Use Swift Charts for line/point/bar visualizations |
Per-frame Task { @MainActor } inside TimelineView body | Non-mutating snapshot(at:) in body; mutating driver.update in .onChange(of: context.date) |
Key References
See reference.md for detailed explanations of protocol abstractions, accessibility patterns, dark mode guidelines, and anti-pattern rationale.
See examples.md for complete Swift code examples organized by section.
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.

