Token导航 LogoToken导航TokenDH.com
AI 工具需要联网github未标认证来源可访问clear审计提醒

swiftui-patternsSwiftUI 模式

Agent Skill

swiftui-patterns 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,104

周安装

171

GitHub Stars

201

下载量

1,368
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:swiftui-patterns(SwiftUI 模式)
来源仓库:https://github.com/johnrogers/claude-swift-engineering
仓库路径:skills/swiftui-patterns
安装命令:
npx skills add https://github.com/johnrogers/claude-swift-engineering --skill swiftui-patterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/johnrogers/claude-swift-engineering --skill swiftui-patterns

简介

SwiftUI 模式技能用于处理 GitHub 仓库、Issue、Pull Request 等协作信息,适合代码变更跟踪。

  • 它能围绕仓库状态和协作事项进行信息整理,帮助开发者了解项目进展和问题处理情况。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 了解具体用法。
  • 安装前建议确认权限范围和维护状态,注意是否会触发联网或文件读写操作。
  • swiftui-patterns 属于AI 工具类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

SwiftUI Patterns (iOS 17+)

SwiftUI 17+ removes ObservableObject boilerplate with @Observable, simplifies environment injection with @Environment, and introduces task-based async patterns. The core principle: use Apple's modern APIs instead of reactive libraries.

Overview

Quick Reference

NeedUse (iOS 17+)NOT
Observable model@ObservableObservableObject
Published propertyRegular property@Published
Own state@State@StateObject
Passed model (binding)@Bindable@ObservedObject
Environment injectionenvironment(_:)environmentObject(_:)
Environment access@Environment(Type.self)@EnvironmentObject
Async on appear.task {}.onAppear {Task {}}
Value changeonChange(of:initial:_:)onChange(of:perform:)

Core Workflow

  1. Use @Observable for model classes (no @Published needed)
  2. Use @State for view-owned models, @Bindable for passed models
  3. Use .task {} for async work (auto-cancels on disappear)
  4. Use NavigationStack with NavigationPath for programmatic navigation
  5. Apply .accessibilityLabel() and .accessibilityHint() to interactive elements

Reference Loading Guide

ALWAYS load reference files if there is even a small chance the content may be required. It's better to have the context than to miss a pattern or make a mistake.

ReferenceLoad When
ObservableCreating new @Observable model classes
State ManagementDeciding between @State, @Bindable, @Environment
EnvironmentInjecting dependencies into view hierarchy
View ModifiersUsing onChange, task, or iOS 17+ modifiers
Migration GuideUpdating iOS 16 code to iOS 17+
MVVM ObservableSetting up view model architecture
NavigationProgrammatic or deep-link navigation
PerformanceLists with 100+ items or excessive re-renders
UIKit InteropWrapping UIKit components (WKWebView, PHPicker)
AccessibilityVoiceOver, Dynamic Type, accessibility actions
Async PatternsLoading states, refresh, background tasks
CompositionReusable view modifiers or complex conditional UI

Common Mistakes

  1. Over-using @Bindable for passed models — Creating @Bindable for every property causes unnecessary view reloads. Use @Bindable only for mutable model properties that need two-way binding. Read-only computed properties should use regular properties.
  2. State placement errors — Putting model state in the view instead of a dedicated @Observable model causes view logic to become tangled. Always separate model and view concerns.
  3. NavigationPath state corruption — Mutating NavigationPath incorrectly can leave it in inconsistent state. Use navigationDestination(for:destination:) with proper state management to avoid path corruption.
  4. Missing .task cancellation.task handles cancellation on disappear automatically, but nested Tasks don't. Complex async flows need explicit cancellation tracking to avoid zombie tasks.
  5. Ignoring environment invalidation — Changing environment values at parent doesn't invalidate child views automatically. Use @Environment consistently and understand when re-renders happen based on observation.
  6. UIKit interop memory leaksUIViewRepresentable and UIViewControllerRepresentable can leak if delegate cycles aren't broken. Weak references and explicit cleanup are required.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.26%
按下载量换算387

OpenCode

23.35%
按下载量换算319

Cursor

18.47%
按下载量换算253

Antigravity

15.01%
按下载量换算205

Codex

9.14%
按下载量换算125

Gemini CLI

3.86%
按下载量换算53

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills