Swiftui Expert Skill
omarshahine/HomeClaw
A skill your agent uses when writing, reviewing, or refactoring SwiftUI code for iOS or macOS, including state management, view composition, performance, Liquid Glass adoption, or Instruments .trace…
SwiftUI 架构模式,使用 @Observable 进行状态管理,视图组合,导航,性能优化,以及现代 iOS/macOS UI 最佳实践。
$ npx skills add affaan-m/ECC --skill swiftui-patterns -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install affaan-m/ECC swiftui-patterns --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .claude/skills && cp -r skills-src/docs/zh-CN/skills/swiftui-patterns .claude/skills/swiftui-patterns && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "swiftui-patterns" agent skill from https://github.com/affaan-m/ECC/tree/main/docs/zh-CN/skills/swiftui-patterns into .claude/skills/swiftui-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-patterns", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/affaan-m/ECC/tree/main/docs/zh-CN/skills/swiftui-patternsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add affaan-m/ECC --skill swiftui-patterns -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install affaan-m/ECC swiftui-patterns --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .agents/skills && cp -r skills-src/docs/zh-CN/skills/swiftui-patterns .agents/skills/swiftui-patterns && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "swiftui-patterns" agent skill from https://github.com/affaan-m/ECC/tree/main/docs/zh-CN/skills/swiftui-patterns into .agents/skills/swiftui-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-patterns", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add affaan-m/ECC --skill swiftui-patterns -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install affaan-m/ECC swiftui-patterns --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/docs/zh-CN/skills/swiftui-patterns .cursor/skills/swiftui-patterns && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "swiftui-patterns" agent skill from https://github.com/affaan-m/ECC/tree/main/docs/zh-CN/skills/swiftui-patterns into .cursor/skills/swiftui-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-patterns", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/affaan-m/ECC.git --path docs/zh-CN/skills/swiftui-patterns--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add affaan-m/ECC --skill swiftui-patterns -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install affaan-m/ECC swiftui-patterns --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/docs/zh-CN/skills/swiftui-patterns .gemini/skills/swiftui-patterns && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "swiftui-patterns" agent skill from https://github.com/affaan-m/ECC/tree/main/docs/zh-CN/skills/swiftui-patterns into .gemini/skills/swiftui-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-patterns", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install affaan-m/ECC swiftui-patternsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add affaan-m/ECC --skill swiftui-patterns -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .github/skills && cp -r skills-src/docs/zh-CN/skills/swiftui-patterns .github/skills/swiftui-patterns && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "swiftui-patterns" agent skill from https://github.com/affaan-m/ECC/tree/main/docs/zh-CN/skills/swiftui-patterns into .github/skills/swiftui-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-patterns", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add affaan-m/ECC --skill swiftui-patterns -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install affaan-m/ECC swiftui-patterns --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/affaan-m/ECC.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/docs/zh-CN/skills/swiftui-patterns .opencode/skills/swiftui-patterns && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "swiftui-patterns" agent skill from https://github.com/affaan-m/ECC/tree/main/docs/zh-CN/skills/swiftui-patterns into .opencode/skills/swiftui-patterns/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "swiftui-patterns", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
swiftui-patternsSwiftUI 架构模式,使用 @Observable 进行状态管理,视图组合,导航,性能优化,以及现代 iOS/macOS UI 最佳实践。
Swiftui Patterns is an agent skill from affaan-m/ECC. SwiftUI 架构模式,使用 @Observable 进行状态管理,视图组合,导航,性能优化,以及现代 iOS/macOS UI 最佳实践。
Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Mobile, covering iOS development. It works with SwiftUI, iOS and macOS. The repository describes itself as: The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond. The licence is MIT.
Read from SKILL.md and the folder at commit ef648e0. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are swift).
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Swiftui Patterns loads about 1.4k tokens when it runs. Until then it costs about 22 tokens; SKILL.md has 165 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from affaan-m/ECC at commit ef648e0, republished under its MIT licence (© affaan-m). 165 words, ~1,367 tokens.
.claude/skills/swiftui-patterns/SKILL.md (or your agent's skills folder).适用于 Apple 平台的现代 SwiftUI 模式,用于构建声明式、高性能的用户界面。涵盖 Observation 框架、视图组合、类型安全导航和性能优化。
@State、@Observable、@Binding)NavigationStack 设计导航流程时选择最适合的最简单包装器:
| 包装器 | 使用场景 |
|---|---|
@State | 视图本地的值类型(开关、表单字段、Sheet 展示) |
@Binding | 指向父视图 @State 的双向引用 |
@Observable 类 + @State | 拥有多个属性的自有模型 |
@Observable 类(无包装器) | 从父视图传递的只读引用 |
@Bindable | 指向 @Observable 属性的双向绑定 |
@Environment | 通过 .environment() 注入的共享依赖项 |
使用 @Observable(而非 ObservableObject)—— 它跟踪属性级别的变更,因此 SwiftUI 只会重新渲染读取了已变更属性的视图:
@Observable
final class ItemListViewModel {
private(set) var items: [Item] = []
private(set) var isLoading = false
var searchText = ""
private let repository: any ItemRepository
init(repository: any ItemRepository = DefaultItemRepository()) {
self.repository = repository
}
func load() async {
isLoading = true
defer { isLoading = false }
items = (try? await repository.fetchAll()) ?? []
}
}struct ItemListView: View {
@State private var viewModel: ItemListViewModel
init(viewModel: ItemListViewModel = ItemListViewModel()) {
_viewModel = State(initialValue: viewModel)
}
var body: some View {
List(viewModel.items) { item in
ItemRow(item: item)
}
.searchable(text: $viewModel.searchText)
.overlay { if viewModel.isLoading { ProgressView() } }
.task { await viewModel.load() }
}
}用 @Environment 替换 @EnvironmentObject:
// Inject
ContentView()
.environment(authManager)
// Consume
struct ProfileView: View {
@Environment(AuthManager.self) private var auth
var body: some View {
Text(auth.currentUser?.name ?? "Guest")
}
}将视图拆分为小型、专注的结构体。当状态变更时,只有读取该状态的子视图会重新渲染:
struct OrderView: View {
@State private var viewModel = OrderViewModel()
var body: some View {
VStack {
OrderHeader(title: viewModel.title)
OrderItemList(items: viewModel.items)
OrderTotal(total: viewModel.total)
}
}
}struct CardModifier: ViewModifier {
func body(content: Content) -> some View {
content
.padding()
.background(.regularMaterial)
.clipShape(RoundedRectangle(cornerRadius: 12))
}
}
extension View {
func cardStyle() -> some View {
modifier(CardModifier())
}
}使用 NavigationStack 与 NavigationPath 来实现程序化、类型安全的路由:
@Observable
final class Router {
var path = NavigationPath()
func navigate(to destination: Destination) {
path.append(destination)
}
func popToRoot() {
path = NavigationPath()
}
}
enum Destination: Hashable {
case detail(Item.ID)
case settings
case profile(User.ID)
}
struct RootView: View {
@State private var router = Router()
var body: some View {
NavigationStack(path: $router.path) {
HomeView()
.navigationDestination(for: Destination.self) { dest in
switch dest {
case .detail(let id): ItemDetailView(itemID: id)
case .settings: SettingsView()
case .profile(let id): ProfileView(userID: id)
}
}
}
.environment(router)
}
}LazyVStack 和 LazyHStack 仅在视图可见时才创建它们:
ScrollView {
LazyVStack(spacing: 8) {
ForEach(items) { item in
ItemRow(item: item)
}
}
}在 ForEach 中始终使用稳定、唯一的 ID —— 避免使用数组索引:
// Use Identifiable conformance or explicit id
ForEach(items, id: \.stableID) { item in
ItemRow(item: item)
}body 内执行 I/O、网络调用或繁重计算.task {} 处理异步工作 —— 当视图消失时它会自动取消.sensoryFeedback() 和 .geometryGroup().shadow()、.blur() 和 .mask() —— 它们会触发屏幕外渲染对于 body 计算昂贵的视图,遵循 Equatable 以跳过不必要的重新渲染:
struct ExpensiveChartView: View, Equatable {
let dataPoints: [DataPoint] // DataPoint must conform to Equatable
static func == (lhs: Self, rhs: Self) -> Bool {
lhs.dataPoints == rhs.dataPoints
}
var body: some View {
// Complex chart rendering
}
}使用 #Preview 宏配合内联模拟数据以进行快速迭代:
#Preview("Empty state") {
ItemListView(viewModel: ItemListViewModel(repository: EmptyMockRepository()))
}
#Preview("Loaded") {
ItemListView(viewModel: ItemListViewModel(repository: PopulatedMockRepository()))
}ObservableObject / @Published / @StateObject / @EnvironmentObject —— 迁移到 @Observablebody 或 init 中 —— 使用 .task {} 或显式的加载方法@State —— 改为从父视图传递AnyView 类型擦除 —— 对于条件视图,优先选择 @ViewBuilder 或 GroupSendable 要求查看技能:swift-actor-persistence 以了解基于 Actor 的持久化模式。
查看技能:swift-protocol-di-testing 以了解基于协议的 DI 和使用 Swift Testing 进行测试。
© affaan-m, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in docs/zh-CN/skills/swiftui-patterns of affaan-m/ECC.
Open the folder on GitHubat commit ef648e0
We found 3 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 3 other GitHub owners. This page covers the copy in affaan-m/ECC, which our catalogue first saw on October 7, 2026.
Swiftui Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Swiftui Patterns this skillaffaan-m/ECC | 276k | 3 repos | ~1.4k | Automated safety check: Pass | MIT | |
| Swiftui Expert Skillomarshahine/HomeClaw | 175 | 4 repos | ~2.8k | Automated safety check: Pass | MIT | |
| Hig Project Contextraintree-technology/hig-doctor | 143 | 5 repos | ~1.2k | Automated safety check: Pass | MIT | |
| Swiftui Expert SkillEslzzyl/Pixiv-SwiftUI | 111 | 1 repos | ~2.9k | Automated safety check: Pass | AGPL-3.0 | |
| Hig Components Contentraintree-technology/hig-doctor | 143 | 5 repos | ~1.3k | Automated safety check: Pass | MIT | |
| SwiftUI Design SkillWholiver/swiftui-design-skill | 213 | — | ~2.8k | Automated safety check: Pass | MIT |
omarshahine/HomeClaw
A skill your agent uses when writing, reviewing, or refactoring SwiftUI code for iOS or macOS, including state management, view composition, performance, Liquid Glass adoption, or Instruments .trace…
raintree-technology/hig-doctor
Create or update a shared Apple design context document that other HIG skills use to tailor guidance.
Eslzzyl/Pixiv-SwiftUI
A skill your agent uses when writing, reviewing, or refactoring SwiftUI code for iOS or macOS, including state and @Observable data flow, view composition, resizable layouts, safe areas, display…
raintree-technology/hig-doctor
Apple Human Interface Guidelines for content display components.
Wholiver/swiftui-design-skill
Guides the agent to design distinctive SwiftUI interfaces for iOS and macOS, with six anti-generic rules, a design direction workflow and a five-dimension review.
shaps80/SwiftUIBackports
Find SwiftUIBackports replacements for SwiftUI APIs unavailable on a project deployment target.
affaan-m/ECC
Audits your installed Claude skills and commands for quality, with a quick mode for recently changed skills and a full mode that evaluates all of them through subagents.
affaan-m/ECC
Ingests, indexes, searches, edits and monitors video, audio and live streams through the VideoDB Python SDK, returning stream links, clips and timestamps.
affaan-m/ECC
Scans installed skills for principles that recur across them and proposes rule-file changes: append, revise, add a section, create a file or leave as covered.
affaan-m/ECC
Builds DRAFT counterparty agreements from one markdown template and a small JSON spec per party, with clauses picked by the party's role.
affaan-m/ECC
Measures whether agents actually follow a skill, rule or agent definition by generating scenarios at three strictness levels and scoring tool-call traces.
affaan-m/ECC
Instinct-based learning system that observes sessions via hooks, creates atomic instincts with confidence scoring, and evolves them into skills/commands/agents.
Categories
SwiftUI 架构模式,使用 @Observable 进行状态管理,视图组合,导航,性能优化,以及现代 iOS/macOS UI 最佳实践。. Swiftui Patterns is an agent skill from affaan-m/ECC.
Swiftui Patterns fits situations like: tasks that involve iOS development.
Run `npx skills add affaan-m/ECC --skill swiftui-patterns -a claude-code`. Or copy the skill folder (docs/zh-CN/skills/swiftui-patterns in affaan-m/ECC) into .claude/skills/swiftui-patterns in your project. Claude Code loads it when a task matches its description.
Run `npx skills add affaan-m/ECC --skill swiftui-patterns -a codex`. Or copy the skill folder (docs/zh-CN/skills/swiftui-patterns in affaan-m/ECC) into .agents/skills/swiftui-patterns in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add affaan-m/ECC --skill swiftui-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/swiftui-patterns, .gemini/skills/swiftui-patterns, .github/skills/swiftui-patterns and .opencode/skills/swiftui-patterns in your project.
SKILL.md names no scripts, command-line tools or credentials: Swiftui Patterns is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Swiftui Patterns is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 1.4k tokens (SKILL.md is roughly 5.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Swiftui Patterns: Swiftui Expert Skill (omarshahine/HomeClaw, 175 stars), Hig Project Context (raintree-technology/hig-doctor, 143 stars), Swiftui Expert Skill (Eslzzyl/Pixiv-SwiftUI, 111 stars) and Hig Components Content (raintree-technology/hig-doctor, 143 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
affaan-m (a GitHub user) maintains it in affaan-m/ECC, which has 275,546 GitHub stars. The repository holds 673 skills in this directory. The repository was last updated on October 5, 2026.
Source: affaan-m/ECC on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.