用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/mikailustuner/OmniRule --skill swiftui-patterns命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Bun runtime: HTTP server, file I/O, SQLite, test runner, package manager, bundler — all-in-one JS toolchain.
Clerk: Drop-in auth UI, Organizations, User management, JWT templates, webhooks, Next.js middleware integration.
Gelişmiş masaüstü, tarayıcı ve işletim sistemi kontrol yeteneği. Görsel (koordinat tabanlı) fare/klavye otomasyonu, DOM manipülasyonu, pencere yönetimi, gelişmiş dosya, ağ ve süreç yönetimini kapsar.
基于 SOC 职业分类
正在显示 SKILL.md
| name | swiftui-patterns |
| description | SwiftUI Patterns: Declarative UI, State management, Navigation, Composability, Animations. |
| triggers | {"extensions":[".swift"],"directories":["ios/","macos/","swift/","apple/"],"keywords":["swiftui","swift","xcode","ios","macos","watchos","apple","@State","@Binding","@ObservedObject","@Environment"]} |
| auto_load_when | Building Apple native apps with SwiftUI |
| agent | swift-developer |
| tools | ["Read","Write","Bash"] |
Focus: Declarative UI, state management, modern Swift
State Management:
├── @State - Local view state
│ └── struct ContentView: View {
│ @State private var isPresented = false
│ }
│
├── @Binding - Two-way binding
│ └── Child receives reference, can modify parent
│
├── @ObservedObject - External reference type
│ └── class MyViewModel: ObservableObject
│ └── @Published properties trigger view update
│
├── @Environment - Injected dependencies
│ └── @Environment(\.colorScheme) var colorScheme
│ └── @Environment(\.dismiss) var dismiss
│
└── @StateObject - View-owned lifecycle
└── @StateObject var viewModel = MyViewModel()
Concurrency:
├── async/await
│ └── func fetchData() async throws -> Data
│
├── Task and TaskGroup
│ └── await withTaskGroup(of: Void.self) { group in
│ group.addTask { await self.fetchA() }
│ group.addTask { await self.fetchB() }
│ }
│
├── Actor for thread safety
│ └── actor DataStore { ... }
│
└── @MainActor for UI updates
└── @MainActor func updateUI() // runs on main thread
Navigation Types:
├── NavigationStack (iOS 16+)
│ └── NavigationLink(value:) → NavigationDestination
│ └── Type-safe navigation with path
│
├── NavigationPath
│ └── let path = NavigationPath()
│ └── path.append(Destination.detail)
│
├── Sheet and FullScreenCover
│ └── .sheet(isPresented:) { SheetContent() }
│
└── TabView
└── TabView { ... }
└── .tabViewStyle(.page) for carousel
Data Flow Patterns:
├── @FetchRequest for Core Data
│ └── @FetchRequest(sortDescriptors: ...) var items: FetchedResults<Item>
│
├── @Query for SwiftData (iOS 17+)
│ └── @Query var items: [Item]
│
└── Networking with async/await
└── struct API {
static func fetch() async throws -> [Model]
}
└── URLSession.shared.data(from: url)
❌ Using @StateObject in structs — only in views
✅ Class conforms to ObservableObject, use @ObservedObject or @StateObject in view
❌ Mixing UIKit and SwiftUI unnecessarily
✅ Use UIViewRepresentable only when needed
❌ Not handling loading/error states
✅ Use @State var isLoading: Bool = false, show Alert on error
❌ Hardcoded frames — breaks accessibility
✅ Use .frame(maxWidth: .infinity) not fixed widths
❌ Not supporting Dynamic Type
✅ Use .font(.body) not .font(.system(size: 17))
| Pattern | SwiftUI | UIKit equivalent |
|---|---|---|
| List | List {} | UITableView |
| ScrollView | ScrollView {} | UIScrollView |
| Button | Button("Title") {} | UIButton |
| TextField | TextField("Label", text: $var) | UITextField |
| Image | Image("name") | UIImageView |
| Navigation | NavigationStack {} | UINavigationController |
| Tab | TabView {} | UITabBarController |