swiftui-expert-skill
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSwiftUI Expert Skill
SwiftUI 专家技能指南
Overview
概述
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.
使用本技能可按照正确的状态管理、现代API使用、Swift并发最佳实践、最优视图组合以及iOS 26+ Liquid Glass样式规范,构建、审核或改进SwiftUI功能。优先使用原生API、Apple设计指南和注重性能的模式。本技能聚焦于事实与最佳实践,不强制特定架构模式。
Workflow Decision Tree
工作流决策树
1) Review existing SwiftUI code
1) 审核现有SwiftUI代码
- Check property wrapper usage against the selection guide (see )
references/state-management.md - Verify modern API usage (see )
references/modern-apis.md - Verify view composition follows extraction rules (see )
references/view-structure.md - Check performance patterns are applied (see )
references/performance-patterns.md - Verify list patterns use stable identity (see )
references/list-patterns.md - Check animation patterns for correctness (see ,
references/animation-basics.md)references/animation-transitions.md - Inspect Liquid Glass usage for correctness and consistency (see )
references/liquid-glass.md - Validate iOS 26+ availability handling with sensible fallbacks
- 对照选择指南检查属性包装器的使用(参见)
references/state-management.md - 验证现代API的使用情况(参见)
references/modern-apis.md - 验证视图组合是否遵循提取规则(参见)
references/view-structure.md - 检查是否应用了性能优化模式(参见)
references/performance-patterns.md - 验证列表模式是否使用稳定标识(参见)
references/list-patterns.md - 检查动画模式的正确性(参见、
references/animation-basics.md)references/animation-transitions.md - 检查Liquid Glass的使用是否正确且一致(参见)
references/liquid-glass.md - 验证iOS 26+特性的可用性处理是否包含合理的降级方案
2) Improve existing SwiftUI code
2) 改进现有SwiftUI代码
- Audit state management for correct wrapper selection (prefer over
@Observable)ObservableObject - Replace deprecated APIs with modern equivalents (see )
references/modern-apis.md - Extract complex views into separate subviews (see )
references/view-structure.md - Refactor hot paths to minimize redundant state updates (see )
references/performance-patterns.md - Ensure ForEach uses stable identity (see )
references/list-patterns.md - Improve animation patterns (use value parameter, proper transitions, see ,
references/animation-basics.md)references/animation-transitions.md - Suggest image downsampling when is used (as optional optimization, see
UIImage(data:))references/image-optimization.md - Adopt Liquid Glass only when explicitly requested by the user
- 审核状态管理,确保选择正确的包装器(优先使用而非
@Observable)ObservableObject - 使用现代等效API替代已废弃的API(参见)
references/modern-apis.md - 将复杂视图提取为独立的子视图(参见)
references/view-structure.md - 重构热点路径以减少冗余状态更新(参见)
references/performance-patterns.md - 确保ForEach使用稳定标识(参见)
references/list-patterns.md - 优化动画模式(使用value参数、正确的过渡效果,参见、
references/animation-basics.md)references/animation-transitions.md - 当检测到使用时,建议采用图像降采样作为可选优化方案(参见
UIImage(data:))references/image-optimization.md - 仅在用户明确要求时才适配Liquid Glass
3) Implement new SwiftUI feature
3) 实现新的SwiftUI功能
- Design data flow first: identify owned vs injected state (see )
references/state-management.md - Use modern APIs (no deprecated modifiers or patterns, see )
references/modern-apis.md - Use for shared state (with
@Observableif not using default actor isolation)@MainActor - Structure views for optimal diffing (extract subviews early, keep views small, see )
references/view-structure.md - Separate business logic into testable models (see )
references/layout-best-practices.md - Use correct animation patterns (implicit vs explicit, transitions, see ,
references/animation-basics.md,references/animation-transitions.md)references/animation-advanced.md - Apply glass effects after layout/appearance modifiers (see )
references/liquid-glass.md - Gate iOS 26+ features with and provide fallbacks
#available
- 先设计数据流:区分自有状态与注入状态(参见)
references/state-management.md - 使用现代API(避免已废弃的修饰符或模式,参见)
references/modern-apis.md - 对共享状态使用(若未使用默认actor隔离,则添加
@Observable标记)@MainActor - 构建视图结构以实现最优差异对比(尽早提取子视图,保持视图轻量化,参见)
references/view-structure.md - 将业务逻辑分离到可测试的模型中(参见)
references/layout-best-practices.md - 使用正确的动画模式(隐式/显式动画、过渡效果,参见、
references/animation-basics.md、references/animation-transitions.md)references/animation-advanced.md - 在布局/外观修饰符之后应用玻璃效果(参见)
references/liquid-glass.md - 使用包裹iOS 26+特性并提供降级方案
#available
Core Guidelines
核心准则
State Management
状态管理
- Always prefer over
@Observablefor new codeObservableObject - Mark classes with
@Observableunless using default actor isolation@MainActor - Always mark and
@Stateas@StateObject(makes dependencies clear)private - Never declare passed values as or
@State(they only accept initial values)@StateObject - Use with
@Stateclasses (not@Observable)@StateObject - only when child needs to modify parent state
@Binding - for injected
@Bindableobjects needing bindings@Observable - Use for read-only values;
let+varfor reactive reads.onChange() - Legacy: for owned
@StateObject;ObservableObjectfor injected@ObservedObject - Nested doesn't work (pass nested objects directly);
ObservableObjecthandles nesting fine@Observable
- 新代码中始终优先使用而非
@ObservableObservableObject - 为类标记
@Observable,除非使用默认actor隔离@MainActor - 始终将和
@State标记为@StateObject(明确依赖关系)private - 绝不要将传入的值声明为或
@State(它们仅接受初始值)@StateObject - 为类搭配使用
@Observable(而非@State)@StateObject - 仅当子视图需要修改父视图状态时使用
@Binding - 对于需要绑定的注入式对象,使用
@Observable@Bindable - 只读值使用;响应式读取使用
let+var.onChange() - 遗留方案:自有使用
ObservableObject;注入式@StateObject使用ObservableObject@ObservedObject - 嵌套无法正常工作(直接传递嵌套对象即可);
ObservableObject可完美处理嵌套场景@Observable
Modern APIs
现代API
- Use instead of
foregroundStyle()foregroundColor() - Use instead of
clipShape(.rect(cornerRadius:))cornerRadius() - Use API instead of
TabtabItem() - Use instead of
Button(unless need location/count)onTapGesture() - Use instead of
NavigationStackNavigationView - Use for type-safe navigation
navigationDestination(for:) - Use two-parameter or no-parameter variant
onChange() - Use for rendering SwiftUI views
ImageRenderer - Use instead of
.sheet(item:)for model-based content.sheet(isPresented:) - Sheets should own their actions and call internally
dismiss() - Use for programmatic scrolling with stable IDs
ScrollViewReader - Avoid for sizing
UIScreen.main.bounds - Avoid when alternatives exist (e.g.,
GeometryReader)containerRelativeFrame()
- 使用替代
foregroundStyle()foregroundColor() - 使用替代
clipShape(.rect(cornerRadius:))cornerRadius() - 使用API替代
TabtabItem() - 使用替代
Button(除非需要获取点击位置或次数)onTapGesture() - 使用替代
NavigationStackNavigationView - 使用实现类型安全的导航
navigationDestination(for:) - 使用双参数或无参数的变体
onChange() - 使用渲染SwiftUI视图
ImageRenderer - 使用替代
.sheet(item:)实现基于模型的内容展示.sheet(isPresented:) - Sheet应自行管理操作并在内部调用
dismiss() - 使用结合稳定ID实现程序化滚动
ScrollViewReader - 避免使用进行尺寸设置
UIScreen.main.bounds - 当存在替代方案时(如),避免使用
containerRelativeFrame()GeometryReader
Swift Best Practices
Swift最佳实践
- Use modern Text formatting (parameters, not
.format)String(format:) - Use for user-input filtering (not
localizedStandardContains())contains() - Prefer static member lookup (vs
.blue)Color.blue - Use modifier for automatic cancellation of async work
.task - Use for value-dependent tasks
.task(id:)
- 使用现代文本格式化方式(参数,而非
.format)String(format:) - 对用户输入过滤使用(而非
localizedStandardContains())contains() - 优先使用静态成员查找(而非
.blue)Color.blue - 使用修饰符自动取消异步任务
.task - 使用处理依赖于特定值的任务
.task(id:)
View Composition
视图组合
- Prefer modifiers over conditional views for state changes (maintains view identity)
- Extract complex views into separate subviews for better readability and performance
- Keep views small for optimal performance
- Keep view simple and pure (no side effects or complex logic)
body - Use functions only for small, simple sections
@ViewBuilder - Prefer over closure-based content properties
@ViewBuilder let content: Content - Separate business logic into testable models (not about enforcing architectures)
- Action handlers should reference methods, not contain inline logic
- Use relative layout over hard-coded constants
- Views should work in any context (don't assume screen size or presentation style)
- 状态变化优先使用修饰符而非条件视图(保持视图标识的一致性)
- 将复杂视图提取为独立子视图,提升可读性与性能
- 保持视图轻量化以优化性能
- 保持视图简洁且无副作用(不包含复杂逻辑)
body - 仅在小型、简单的代码段中使用函数
@ViewBuilder - 优先使用而非基于闭包的内容属性
@ViewBuilder let content: Content - 将业务逻辑分离到可测试的模型中(不强制特定架构)
- 事件处理函数应引用方法,而非包含内联逻辑
- 使用相对布局而非硬编码常量
- 视图应适配任意上下文(不要假设屏幕尺寸或展示样式)
Performance
性能优化
- Pass only needed values to views (avoid large "config" or "context" objects)
- Eliminate unnecessary dependencies to reduce update fan-out
- Check for value changes before assigning state in hot paths
- Avoid redundant state updates in ,
onReceive, scroll handlersonChange - Minimize work in frequently executed code paths
- Use /
LazyVStackfor large listsLazyHStack - Use stable identity for (never
ForEachfor dynamic content).indices - Ensure constant number of views per element
ForEach - Avoid inline filtering in (prefilter and cache)
ForEach - Avoid in list rows
AnyView - Consider POD views for fast diffing (or wrap expensive views in POD parents)
- Suggest image downsampling when is encountered (as optional optimization)
UIImage(data:) - Avoid layout thrash (deep hierarchies, excessive )
GeometryReader - Gate frequent geometry updates by thresholds
- Use to debug unexpected view updates
Self._printChanges()
- 仅向视图传递所需的值(避免传递大型的"配置"或"上下文"对象)
- 消除不必要的依赖以减少更新扩散
- 在热点路径中,赋值状态前先检查值是否发生变化
- 避免在、
onReceive、滚动处理程序中进行冗余状态更新onChange - 尽量减少频繁执行代码路径中的工作量
- 大型列表使用/
LazyVStackLazyHStack - 使用稳定标识(动态内容绝不要使用
ForEach).indices - 确保每个元素对应的视图数量保持恒定
ForEach - 避免在中进行内联过滤(提前过滤并缓存结果)
ForEach - 列表行中避免使用
AnyView - 考虑使用POD视图实现快速差异对比(或将性能开销大的视图包裹在POD父视图中)
- 当检测到使用时,建议采用图像降采样作为可选优化方案
UIImage(data:) - 避免布局抖动(过深的层级、过度使用)
GeometryReader - 通过阈值控制频繁的几何更新
- 使用调试意外的视图更新
Self._printChanges()
Animations
动画
- Use with value parameter (deprecated version without value is too broad)
.animation(_:value:) - Use for event-driven animations (button taps, gestures)
withAnimation - Prefer transforms (,
offset,scale) over layout changes (rotation) for performanceframe - Transitions require animations outside the conditional structure
- Custom implementations must have explicit
AnimatableanimatableData - Use for multi-step sequences (iOS 17+)
.phaseAnimator - Use for precise timing control (iOS 17+)
.keyframeAnimator - Animation completion handlers need for reexecution
.transaction(value:) - Implicit animations override explicit animations (later in view tree wins)
- 使用带value参数的(不带value的废弃版本作用范围过广)
.animation(_:value:) - 事件驱动的动画(按钮点击、手势)使用
withAnimation - 为提升性能,优先使用变换(、
offset、scale)而非布局变更(rotation)frame - 过渡效果需要在条件结构外部添加动画
- 自定义实现必须包含显式的
AnimatableanimatableData - 多步骤序列动画使用(iOS 17+)
.phaseAnimator - 需要精确时间控制的动画使用(iOS 17+)
.keyframeAnimator - 动画完成处理程序需要使用以支持重新执行
.transaction(value:) - 隐式动画会覆盖显式动画(视图树中靠后的动画优先级更高)
Liquid Glass (iOS 26+)
Liquid Glass(iOS 26+)
Only adopt when explicitly requested by the user.
- Use native ,
glassEffect, and glass button stylesGlassEffectContainer - Wrap multiple glass elements in
GlassEffectContainer - Apply after layout and visual modifiers
.glassEffect() - Use only for tappable/focusable elements
.interactive() - Use with
glassEffectIDfor morphing transitions@Namespace
仅在用户明确要求时才适配。
- 使用原生的、
glassEffect和玻璃按钮样式GlassEffectContainer - 将多个玻璃元素包裹在中
GlassEffectContainer - 在布局和视觉修饰符之后应用
.glassEffect() - 仅为可点击/可聚焦的元素添加
.interactive() - 使用结合
glassEffectID实现变形过渡@Namespace
Quick Reference
快速参考
Property Wrapper Selection (Modern)
属性包装器选择(现代方案)
| Wrapper | Use When |
|---|---|
| Internal view state (must be |
| Child modifies parent's state |
| Injected |
| Read-only value from parent |
| Read-only value watched via |
Legacy (Pre-iOS 17):
| Wrapper | Use When |
|---|---|
| View owns an |
| View receives an |
| 包装器 | 使用场景 |
|---|---|
| 视图内部状态(必须标记为 |
| 子视图需要修改父视图状态 |
| 需要绑定的注入式 |
| 来自父视图的只读值 |
| 通过 |
遗留方案(iOS 17之前):
| 包装器 | 使用场景 |
|---|---|
| 视图自有 |
| 视图接收的注入式 |
Modern API Replacements
现代API替代方案
| Deprecated | Modern Alternative |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| 已废弃API | 现代替代方案 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Liquid Glass Patterns
Liquid Glass示例代码
swift
// 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)swift
// 基础玻璃效果及降级方案
if #available(iOS 26, *) {
content
.padding()
.glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
} else {
content
.padding()
.background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
}
// 分组玻璃元素
GlassEffectContainer(spacing: 24) {
HStack(spacing: 24) {
GlassButton1()
GlassButton2()
}
}
// 玻璃按钮
Button("Confirm") { }
.buttonStyle(.glassProminent)Review Checklist
审核检查清单
State Management
状态管理
- Using instead of
@Observablefor new codeObservableObject - classes marked with
@Observable(if needed)@MainActor - Using with
@Stateclasses (not@Observable)@StateObject - and
@Stateproperties are@StateObjectprivate - Passed values NOT declared as or
@State@StateObject - only where child modifies parent state
@Binding - for injected
@Bindableneeding bindings@Observable - Nested avoided (or passed directly to child views)
ObservableObject
- 新代码使用而非
@ObservableObservableObject - 类已标记
@Observable(若需要)@MainActor - 为类搭配使用
@Observable(而非@State)@StateObject - 和
@State属性已标记为@StateObjectprivate - 传入的值未被声明为或
@State@StateObject - 仅在子视图需要修改父视图状态时使用
@Binding - 为需要绑定的注入式对象使用
@Observable@Bindable - 已避免使用嵌套(或已直接传递嵌套对象给子视图)
ObservableObject
Modern APIs (see references/modern-apis.md
)
references/modern-apis.md现代API(参见references/modern-apis.md
)
references/modern-apis.md- Using instead of
foregroundStyle()foregroundColor() - Using instead of
clipShape(.rect(cornerRadius:))cornerRadius() - Using API instead of
TabtabItem() - Using instead of
Button(unless need location/count)onTapGesture() - Using instead of
NavigationStackNavigationView - Avoiding
UIScreen.main.bounds - Using alternatives to when possible
GeometryReader - Button images include text labels for accessibility
- 使用替代
foregroundStyle()foregroundColor() - 使用替代
clipShape(.rect(cornerRadius:))cornerRadius() - 使用API替代
TabtabItem() - 使用替代
Button(除非需要获取点击位置或次数)onTapGesture() - 使用替代
NavigationStackNavigationView - 已避免使用
UIScreen.main.bounds - 当存在替代方案时已避免使用
GeometryReader - 按钮图片已包含文本标签以支持无障碍访问
Sheets & Navigation (see references/sheet-navigation-patterns.md
)
references/sheet-navigation-patterns.md弹窗与导航(参见references/sheet-navigation-patterns.md
)
references/sheet-navigation-patterns.md- Using for model-based sheets
.sheet(item:) - Sheets own their actions and dismiss internally
- Using for type-safe navigation
navigationDestination(for:)
- 使用实现基于模型的弹窗
.sheet(item:) - 弹窗自行管理操作并在内部关闭
- 使用实现类型安全的导航
navigationDestination(for:)
ScrollView (see references/scroll-patterns.md
)
references/scroll-patterns.md滚动视图(参见references/scroll-patterns.md
)
references/scroll-patterns.md- Using with stable IDs for programmatic scrolling
ScrollViewReader - Using instead of initializer parameter
.scrollIndicators(.hidden)
- 使用结合稳定ID实现程序化滚动
ScrollViewReader - 使用替代初始化参数
.scrollIndicators(.hidden)
Text & Formatting (see references/text-formatting.md
)
references/text-formatting.md文本与格式化(参见references/text-formatting.md
)
references/text-formatting.md- Using modern Text formatting (not )
String(format:) - Using for search filtering
localizedStandardContains()
- 使用现代文本格式化方式(而非)
String(format:) - 搜索过滤使用
localizedStandardContains()
View Structure (see references/view-structure.md
)
references/view-structure.md视图结构(参见references/view-structure.md
)
references/view-structure.md- Using modifiers instead of conditionals for state changes
- Complex views extracted to separate subviews
- Views kept small for performance
- Container views use
@ViewBuilder let content: Content
- 使用修饰符而非条件语句处理状态变化
- 复杂视图已提取为独立子视图
- 视图保持轻量化以优化性能
- 容器视图使用
@ViewBuilder let content: Content
Performance (see references/performance-patterns.md
)
references/performance-patterns.md性能优化(参见references/performance-patterns.md
)
references/performance-patterns.md- View kept simple and pure (no side effects)
body - Passing only needed values (not large config objects)
- Eliminating unnecessary dependencies
- State updates check for value changes before assigning
- Hot paths minimize state updates
- No object creation in
body - Heavy computation moved out of
body
- 视图保持简洁且无副作用
body - 仅传递所需的值(而非大型配置对象)
- 已消除不必要的依赖
- 状态更新前已检查值是否发生变化
- 热点路径已尽量减少状态更新
- 未在中创建对象
body - 繁重计算已移出
body
List Patterns (see references/list-patterns.md
)
references/list-patterns.md列表模式(参见references/list-patterns.md
)
references/list-patterns.md- ForEach uses stable identity (not )
.indices - Constant number of views per ForEach element
- No inline filtering in ForEach
- No in list rows
AnyView
- ForEach使用稳定标识(而非)
.indices - ForEach每个元素对应的视图数量保持恒定
- 未在ForEach中进行内联过滤
- 列表行中未使用
AnyView
Layout (see references/layout-best-practices.md
)
references/layout-best-practices.md布局(参见references/layout-best-practices.md
)
references/layout-best-practices.md- Avoiding layout thrash (deep hierarchies, excessive GeometryReader)
- Gating frequent geometry updates by thresholds
- Business logic separated into testable models
- Action handlers reference methods (not inline logic)
- Using relative layout (not hard-coded constants)
- Views work in any context (context-agnostic)
- 已避免布局抖动(过深的层级、过度使用GeometryReader)
- 通过阈值控制频繁的几何更新
- 业务逻辑已分离到可测试的模型中
- 事件处理函数引用方法(而非内联逻辑)
- 使用相对布局(而非硬编码常量)
- 视图可适配任意上下文(与上下文无关)
Animations (see references/animation-basics.md
, references/animation-transitions.md
, references/animation-advanced.md
)
references/animation-basics.mdreferences/animation-transitions.mdreferences/animation-advanced.md动画(参见references/animation-basics.md
、references/animation-transitions.md
、references/animation-advanced.md
)
references/animation-basics.mdreferences/animation-transitions.mdreferences/animation-advanced.md- Using with value parameter
.animation(_:value:) - Using for event-driven animations
withAnimation - Transitions paired with animations outside conditional structure
- Custom has explicit
AnimatableimplementationanimatableData - Preferring transforms over layout changes for animation performance
- Phase animations for multi-step sequences (iOS 17+)
- Keyframe animations for precise timing (iOS 17+)
- Completion handlers use for reexecution
.transaction(value:)
- 使用带value参数的
.animation(_:value:) - 事件驱动的动画使用
withAnimation - 过渡效果已搭配条件结构外部的动画
- 自定义实现包含显式的
AnimatableanimatableData - 为提升性能,优先使用变换而非布局变更
- 多步骤序列动画使用(iOS 17+)
.phaseAnimator - 需要精确时间控制的动画使用(iOS 17+)
.keyframeAnimator - 动画完成处理程序使用以支持重新执行
.transaction(value:)
Liquid Glass (iOS 26+)
Liquid Glass(iOS 26+)
- with fallback for Liquid Glass
#available(iOS 26, *) - Multiple glass views wrapped in
GlassEffectContainer - applied after layout/appearance modifiers
.glassEffect() - only on user-interactable elements
.interactive() - Shapes and tints consistent across related elements
- iOS 26+特性已使用包裹并提供降级方案
#available - 多个玻璃视图已包裹在中
GlassEffectContainer - 已在布局/外观修饰符之后应用
.glassEffect() - 仅用于可交互元素
.interactive() - 相关元素的形状和色调保持一致
References
参考文档
- - Property wrappers and data flow (prefer
references/state-management.md)@Observable - - View composition, extraction, and container patterns
references/view-structure.md - - Performance optimization techniques and anti-patterns
references/performance-patterns.md - - ForEach identity, stability, and list best practices
references/list-patterns.md - - Layout patterns, context-agnostic views, and testability
references/layout-best-practices.md - - Modern API usage and deprecated replacements
references/modern-apis.md - - Core animation concepts, implicit/explicit animations, timing, performance
references/animation-basics.md - - Transitions, custom transitions, Animatable protocol
references/animation-transitions.md - - Transactions, phase/keyframe animations (iOS 17+), completion handlers (iOS 17+)
references/animation-advanced.md - - Sheet presentation and navigation patterns
references/sheet-navigation-patterns.md - - ScrollView patterns and programmatic scrolling
references/scroll-patterns.md - - Modern text formatting and string operations
references/text-formatting.md - - AsyncImage, image downsampling, and optimization
references/image-optimization.md - - iOS 26+ Liquid Glass API
references/liquid-glass.md
- - 属性包装器与数据流(优先使用
references/state-management.md)@Observable - - 视图组合、提取与容器模式
references/view-structure.md - - 性能优化技巧与反模式
references/performance-patterns.md - - ForEach标识、稳定性与列表最佳实践
references/list-patterns.md - - 布局模式、与上下文无关的视图及可测试性
references/layout-best-practices.md - - 现代API使用与已废弃API替代方案
references/modern-apis.md - - 核心动画概念、隐式/显式动画、计时、性能
references/animation-basics.md - - 过渡效果、自定义过渡、Animatable协议
references/animation-transitions.md - - 事务、阶段/关键帧动画(iOS 17+)、完成处理程序(iOS 17+)
references/animation-advanced.md - - 弹窗展示与导航模式
references/sheet-navigation-patterns.md - - 滚动视图模式与程序化滚动
references/scroll-patterns.md - - 现代文本格式化与字符串操作
references/text-formatting.md - - AsyncImage、图像降采样与优化
references/image-optimization.md - - iOS 26+ Liquid Glass API
references/liquid-glass.md
Philosophy
设计理念
This skill focuses on facts and best practices, not architectural opinions:
- We don't enforce specific architectures (e.g., MVVM, VIPER)
- We do encourage separating business logic for testability
- We prioritize modern APIs over deprecated ones
- We emphasize thread safety with and
@MainActor@Observable - We optimize for performance and maintainability
- We follow Apple's Human Interface Guidelines and API design patterns
本技能聚焦于事实与最佳实践,而非架构偏好:
- 不强制特定架构(如MVVM、VIPER)
- 鼓励将业务逻辑分离以提升可测试性
- 优先使用现代API而非已废弃API
- 强调通过和
@MainActor保证线程安全@Observable - 以性能与可维护性为优化目标
- 遵循Apple的人机界面指南与API设计模式