swiftui-advanced

Implement advanced SwiftUI patterns and optimize UI performance.

Updated Oct 4, 2025
One-click install
npx skills add https://github.com/NickChristensen/HealthTrends --skill swiftui-advanced
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-advanced
Source: https://github.com/NickChristensen/HealthTrends/tree/main/.agents/skills/swiftui-advanced
Command: npx skills add https://github.com/NickChristensen/HealthTrends --skill swiftui-advanced

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill guides developers in mastering advanced SwiftUI patterns and optimizing UI performance across complex interfaces.

Core Features & Use Cases

  • Custom View Modifiers: Create reusable, composable UI styles and behaviors.
  • GeometryReader-based layouts and adaptive sizing: Build responsive, space-aware interfaces with efficient layout code.
  • Advanced animations and transitions: Implement sophisticated motion, timing, and visual effects.
  • Custom layouts with the Layout protocol: Design bespoke layout containers beyond stacks and grids.
  • Environment values and PreferenceKey: Inject dependencies and communicate child-to-parent state safely.
  • Performance best practices: Identify and minimize expensive work in view bodies, reduce update frequency, and profile with Instruments.
  • Debugging and testing SwiftUI code: Practical patterns for preview, instrumentation, and debugging.

Quick Start

Start by extracting a reusable view modifier, then prototype a small custom layout and an adaptive GeometryReader example to see updates propagate correctly.

Frequently Asked Questions about swiftui-advanced

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

FAQPage Schema
How do I create custom layouts in SwiftUI beyond standard stacks and grids?

Create custom layouts in SwiftUI by implementing the Layout protocol to design bespoke layout containers. This approach allows you to build complex, custom arrangement logic that extends beyond the capabilities of standard stacks and grids for sophisticated interfaces.

What is the best way to pass data from child to parent views in SwiftUI?

Pass data from child to parent views in SwiftUI using PreferenceKey communication. This pattern enables safe, structured child-to-parent state propagation, allowing parent views to read measurement or state values computed by their children during the layout phase.

How do I use GeometryReader for adaptive sizing without hurting UI performance?

Use GeometryReader for adaptive sizing by reading the local geometry to build responsive, space-aware interfaces. To maintain UI performance, minimize expensive work inside the view body and reduce view update frequency by extracting logic into reusable custom view modifiers.

How do I inject dependencies and shared state across SwiftUI views?

Inject dependencies and shared state across SwiftUI views using environment values. This pattern allows you to propagate shared data and configuration down the view hierarchy efficiently, ensuring sophisticated apps maintain clean state separation.

When should I extract custom view modifiers in SwiftUI?

Extract custom view modifiers in SwiftUI when you need reusable, composable UI styles and behaviors. This pattern reduces view body complexity, minimizes expensive recomputation work, and helps identify performance bottlenecks when profiling with Instruments.

Why is my SwiftUI layout not updating correctly with GeometryReader?

GeometryReader layout issues often stem from expensive work inside the view body causing delayed or missed updates. Debug SwiftUI code using preview, instrumentation, and profiling with Instruments to identify update frequency issues and ensure adaptive sizing propagates correctly.