Loading...
Loading...
Use this skill to build, review, or improve SwiftUI features with correct state management, modern API usage, Swift concurrency best practices, optimal view composition, and iOS 26+ Liquid Glass styling. Prioritize native APIs, Apple design guidance, and performance-conscious patterns. This skill focuses on facts and best practices without enforcing specific architectural patterns.
Use this skill when:
references/state-management.md)references/modern-apis.md)references/view-structure.md)references/performance-patterns.md)references/list-patterns.md)references/liquid-glass.md)@Observable over ObservableObject)references/modern-apis.md)references/view-structure.md)references/performance-patterns.md)references/list-patterns.md)UIImage(data:) is used (as optional optimization, see references/image-optimization.md)references/state-management.md)references/modern-apis.md)@Observable for shared state (with @MainActor if not using default actor isolation)references/view-structure.md)references/layout-best-practices.md)references/liquid-glass.md)#available and provide fallbacks@Observable over ObservableObject for new code@Observable classes with @MainActor unless using default actor isolation@State and @StateObject as private (makes dependencies clear)@State or @StateObject (they only accept initial values)@State with @Observable classes (not @StateObject)@Binding only when child needs to modify parent state@Bindable for injected @Observable objects needing bindingslet for read-only values; var + .onChange() for reactive reads@StateObject for owned ObservableObject; @ObservedObject for injectedObservableObject doesn't work (pass nested objects directly); @Observable handles nesting fineforegroundStyle() instead of foregroundColor()clipShape(.rect(cornerRadius:)) instead of cornerRadius()Tab API instead of tabItem()Button instead of onTapGesture() (unless need location/count)NavigationStack instead of NavigationViewnavigationDestination(for:) for type-safe navigationonChange() variantImageRenderer for rendering SwiftUI views.sheet(item:) instead of .sheet(isPresented:) for model-based contentdismiss() internallyScrollViewReader for programmatic scrolling with stable IDsUIScreen.main.bounds for sizingGeometryReader when alternatives exist (e.g., containerRelativeFrame()).format parameters, not String(format:))localizedStandardContains() for user-input filtering (not contains()).blue vs Color.blue).task modifier for automatic cancellation of async work.task(id:) for value-dependent tasksbody simple and pure (no side effects or complex logic)@ViewBuilder functions only for small, simple sections@ViewBuilder let content: Content over closure-based content propertiesonReceive, onChange, scroll handlersLazyVStack/LazyHStack for large listsForEach (never .indices for dynamic content)ForEach elementForEach (prefilter and cache)AnyView in list rowsUIImage(data:) is encountered (as optional optimization)GeometryReader)Self._printChanges() to debug unexpected view updatesOnly adopt when explicitly requested by the user.
glassEffect, GlassEffectContainer, and glass button stylesGlassEffectContainer.glassEffect() after layout and visual modifiers.interactive() only for tappable/focusable elementsglassEffectID with @Namespace for morphing transitions| Wrapper | Use When |
|---------|----------|
| @State | Internal view state (must be private), or owned @Observable class |
| @Binding | Child modifies parent's state |
| @Bindable | Injected @Observable needing bindings |
| let | Read-only value from parent |
| var | Read-only value watched via .onChange() |
Legacy (Pre-iOS 17):
| Wrapper | Use When |
|---------|----------|
| @StateObject | View owns an ObservableObject (use @State with @Observable instead) |
| @ObservedObject | View receives an ObservableObject |
| Deprecated | Modern Alternative |
|------------|-------------------|
| foregroundColor() | foregroundStyle() |
| cornerRadius() | clipShape(.rect(cornerRadius:)) |
| tabItem() | Tab API |
| onTapGesture() | Button (unless need location/count) |
| NavigationView | NavigationStack |
| onChange(of:) { value in } | onChange(of:) { old, new in } or onChange(of:) { } |
| fontWeight(.bold) | bold() |
| GeometryReader | containerRelativeFrame() or visualEffect() |
| showsIndicators: false | .scrollIndicators(.hidden) |
| String(format: "%.2f", value) | Text(value, format: .number.precision(.fractionLength(2))) |
| string.contains(search) | string.localizedStandardContains(search) (for user input) |
// Basic glass effect with fallback
if #available(iOS 26, *) {
content
.padding()
.glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
} else {
content
.padding()
.background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
}
// Grouped glass elements
GlassEffectContainer(spacing: 24) {
HStack(spacing: 24) {
GlassButton1()
GlassButton2()
}
}
// Glass buttons
Button("Confirm") { }
.buttonStyle(.glassProminent)
@Observable instead of ObservableObject for new code@Observable classes marked with @MainActor (if needed)@State with @Observable classes (not @StateObject)@State and @StateObject properties are private@State or @StateObject@Binding only where child modifies parent state@Bindable for injected @Observable needing bindingsObservableObject avoided (or passed directly to child views)references/modern-apis.md)foregroundStyle() instead of foregroundColor()clipShape(.rect(cornerRadius:)) instead of cornerRadius()Tab API instead of tabItem()Button instead of onTapGesture() (unless need location/count)NavigationStack instead of NavigationViewUIScreen.main.boundsGeometryReader when possiblereferences/sheet-navigation-patterns.md).sheet(item:) for model-based sheetsnavigationDestination(for:) for type-safe navigationreferences/scroll-patterns.md)ScrollViewReader with stable IDs for programmatic scrolling.scrollIndicators(.hidden) instead of initializer parameterreferences/text-formatting.md)String(format:))localizedStandardContains() for search filteringreferences/view-structure.md)@ViewBuilder let content: Contentreferences/performance-patterns.md)body kept simple and pure (no side effects)bodybodyreferences/list-patterns.md).indices)AnyView in list rowsreferences/layout-best-practices.md)#available(iOS 26, *) with fallback for Liquid GlassGlassEffectContainer.glassEffect() applied after layout/appearance modifiers.interactive() only on user-interactable elementsreferences/state-management.md - Property wrappers and data flow (prefer @Observable)references/view-structure.md - View composition, extraction, and container patternsreferences/performance-patterns.md - Performance optimization techniques and anti-patternsreferences/list-patterns.md - ForEach identity, stability, and list best practicesreferences/layout-best-practices.md - Layout patterns, context-agnostic views, and testabilityreferences/modern-apis.md - Modern API usage and deprecated replacementsreferences/sheet-navigation-patterns.md - Sheet presentation and navigation patternsreferences/scroll-patterns.md - ScrollView patterns and programmatic scrollingreferences/text-formatting.md - Modern text formatting and string operationsreferences/image-optimization.md - AsyncImage, image downsampling, and optimizationreferences/liquid-glass.md - iOS 26+ Liquid Glass APIThis skill focuses on facts and best practices, not architectural opinions:
@MainActor and @Observableswiftui-expert-skill is an expert AI persona designed to improve your coding workflow. Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, modern APIs, Swift concurrency, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns. It provides senior-level context directly within your IDE.
To install the swiftui-expert-skill skill, download the package, extract the files to your project's .cursor/skills directory, and type @swiftui-expert-skill in your editor chat to activate the expert instructions.
Yes, the swiftui-expert-skill AI persona is completely free to download and integrate into compatible Agentic IDEs like Cursor, Windsurf, Github Copilot, and Anthropic MCP servers.
Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, modern APIs, Swift concurrency, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns.
Download Skill Package.cursor/skills@swiftui-expert-skill in editor chat.Copy the instructions from the panel on the left and paste them into your custom instructions setting.
"Adding this swiftui-expert-skill persona to my Cursor workspace completely changed the quality of code my AI generates. Saves me hours every week."
Developers who downloaded swiftui-expert-skill also use these elite AI personas.
Expert in building 3D experiences for the web - Three.js, React Three Fiber, Spline, WebGL, and interactive 3D scenes. Covers product configurators, 3D portfolios, immersive websites, and bringing depth to web experiences. Use when: 3D website, three.js, WebGL, react three fiber, 3D experience.
Structured guide for setting up A/B tests with mandatory gates for hypothesis, metrics, and execution readiness.
You are an accessibility expert specializing in WCAG compliance, inclusive design, and assistive technology compatibility. Conduct audits, identify barriers, and provide remediation guidance.
Explore our most popular utilities designed for the modern Indian creator.