> swift-swiftui
Standards for State Management, View Lifecycle, and Property Wrappers. Use when managing SwiftUI state, view lifecycle, or property wrappers like @State and @Binding. (triggers: **/*.swift, @State, @Binding, @ObservedObject, View, body)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/swift-swiftui?format=md"SwiftUI Standards
Priority: P0
Implementation Guidelines
State Management
- @State: Private UI state owned by the view (e.g., toggle, text input).
- @Binding: Two-way connection to parent's @State.
- @ObservedObject: Reference to external observable object.
- @StateObject: View owns the lifecycle of the object.
- @EnvironmentObject: Shared data across view hierarchy.
View Composition
- Extract Subviews: Keep views small (<200 lines). Extract reusable components.
- View Modifiers: Chain modifiers for styling (
.font(),.padding()). - Custom Modifiers: Create
ViewModifierfor reusable styles.
Performance
- Avoid Heavy Computation: Use
@State+.task()for async work. - Equatable: Conform views to
Equatableto prevent unnecessary re-renders. - LazyStacks: Use
LazyVStack/LazyHStackfor large lists.
Anti-Patterns
- @ObservedObject Ownership:
**No @ObservedObject for owned objects**: Use @StateObject. - Heavy body:
**No logic in body**: Move to computed properties or methods. - Force Unwrap in Views:
**No ! in View**: Use if-let or nil coalescing.
References
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)