用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill swift-ios-teaching命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | swift-ios-teaching |
| description | Teach Swift and iOS 26 development to experienced developers Use when this capability is needed. |
| metadata | {"author":"echohello-dev"} |
Use this skill whenever the user asks about Swift language features, SwiftUI patterns, iOS development concepts, or needs help understanding code in this project. Explain concepts by relating them to general modern programming patterns and declarative UI principles, specifically targeting senior engineers familiar with React, TypeScript, Python, Java, and PHP.
| Swift | Concept | React/Web Analogy |
|---|---|---|
@State | Local State | useState hook |
@Binding | Reference State | Prop + Callback (two-way binding) |
@Environment | Context/DI | useContext hook |
@Observable | Data Model | MobX, Signals, or Redux store |
var body: some View | Render | Functional component return / JSX |
.onAppear | Lifecycle | useEffect(() => ..., []) |
.task | Async Lifecycle | useEffect with async/await + cleanup |
.onChange(of:) | Reactive Observer | useEffect(() => ..., [dependency]) |
ForEach | Iteration | array.map() with key |
NavigationStack | Routing | React Router / Next.js Link |
| Swift | Concept | TS / Java / Python / PHP Analogy |
| ------------- | -------------- | ------------------------------------------------- | --------------------------------------------- |
| protocol | Interface | interface (TS/Java), Protocol (Python) |
| struct | Value type | type (TS), POJO (Java), dataclass (Python) |
| class | Reference type | class (Java/PHP/Python) |
| Optional | Nullable | T | null(TS),Optional<T>(Java),?string (PHP) |
| ?? | Nil-coalescing | ?? (TS/PHP), or (Python) |
| enum | Sum type | Enums with associated values (Rust/TS unions) |
| async/await | Concurrency | Same as JS/TS/Python/PHP 8.1+ |
| ARC | Memory Mgmt | Deterministic Reference Counting (vs Java/PHP GC) |
guard statements, or ARC.// Your logic here..padding().background() is different from .background().padding().@State ownership: The view owns it; use @Binding to share write access.body property.[weak self] in closures to prevent strong reference cycles (ARC), similar to avoiding memory leaks in long-running Node.js or Java apps..glassEffect() modifier.@available or #available checks..ultraThinMaterial, .regularMaterial, etc., for blur effects.When teaching, first understand the project structure:
Package.swift).xcodeproj, .xcworkspace)# SwiftPM projects
swift build
swift test
# Xcode projects
xcodebuild -scheme <SchemeName> build
xcodebuild -scheme <SchemeName> test
# If using mise
mise run build
mise run test
Concept:
In SwiftUI, we use @State for local component state, much like useState in React. It should be private because the view owns this source of truth.
Your turn:
How would you declare a private state variable named isToggled that starts as false?
// Declare your state here
Watch out: Mutating @State triggers a view re-render. Unlike React, you can mutate the variable directly (e.g., isToggled.toggle()) instead of using a setter function.
When teaching a concept:
Source: echohello-dev/backstage — distributed by TomeVault.