swiftui-architecture
БесплатноБез исполняемых скриптовНе проверенWHEN building SwiftUI views, managing state, setting up shared services, or making architectural decisions; NOT for UIKit or legacy patterns; provides pure…
от mintuz★ 38 звёзд на GitHubОб этом скилле
Modern SwiftUI Architecture
Pure SwiftUI architecture without legacy ObservableObject ViewModels, combining clear ownership with Apple's SwiftUI performance and API guidance.
Scope
This skill covers evergreen SwiftUI views, data flow, performance, localisation, animations, and soft-deprecated APIs.
- For new iOS 27 / macOS 27 SwiftUI APIs and
@Statemacro migration errors, useswiftui-whats-new-27. - For SwiftUI document-based apps (
Documentprotocol,DocumentGroup), usebuilding-document-based-swiftui-applications. - When asked to restructure UIKit or AppKit code, state that this guidance does not cover UIKit/AppKit internals and leave them alone. Answer only at the boundary:
- Wrap an existing view controller in
UIViewControllerRepresentable(NSViewControllerRepresentableon macOS). - Wrap an existing view in
UIViewRepresentable(NSViewRepresentableon macOS) only when it is already separated from its controller. - Use
UIHostingController(NSHostingControlleron macOS) to show a SwiftUI view inside UIKit/AppKit. - Keep wrapped state where it already lives; pass SwiftUI values into the wrapper and send events back via callbacks.
- Wrap an existing view controller in
Large-Codebase Review Workflow
When asked for general SwiftUI best-practice or performance guidance on a large codebase:
- Scan the project to identify discrete areas.
- Propose focus areas one at a time, offering choices where applicable.
- If the user asks for a whole-codebase review, divide the review into sections with a checklist.
References
Read a reference when its topic applies:
- State ownership, value inputs,
@State, KeyPath bindings, and.onChangeisolation:references/state-management.md @Observableservices,@MainActor,Equatable, and invalidation granularity:references/observable-patterns.md- Async work and
.task(id:)lifecycle:references/async-patterns.md - View structure,
View.init, and single-childGroup:references/structure.md @Entry,EnvironmentValues,FocusedValues, closures, unstable defaults, and high-frequency updates:references/environment.mdForEach,List,Table, identity, derived collections, and unary row fast path:references/foreach.md- Conditional modifiers and
AnyShapeStyle:references/modifiers.md - Localisation,
LocalizedStringResource,bundle: #bundle, and format styles:references/localization.md - Custom
@Animatableviews/shapes andAnimatableValues/AnimatablePair:references/animations.md - Soft-deprecated APIs policy and SDK 27 catalogue:
references/soft-deprecation.md,references/soft-deprecated-apis.md - Navigation and components:
references/navigation-patterns.md,references/lists.md,references/scrollview.md,references/forms.md,references/grids.md,references/sheets.md,references/tabs.md - Anti-patterns audit:
references/anti-patterns.md
Core Architecture and Performance Flow
Give every mutable value and dependency one owner and lifetime (
references/state-management.md,principle-derive-from-one-owner):- Keep screen-local UI state in
private@Statein the view that uses it (privateenables@Statelazy initialisation). - Lift state to the nearest common ancestor when sibling views share it, passing narrow values down and
@Bindingor callbacks up. - Move state into an app-wide shared
@Observableservice only when it must outlive that ancestor, when unrelated features read it, or to avoid threading through unrelated intermediate views. State placed in a shared service persists after the screen closes and invalidates every reader when it changes (principle-narrow-state-lifetime). - Retain each shared service once with
@State, inject each service separately via.environment(...), and mutate shared state through actions on the service. - A view-local
@State private var model = ...@Observablemodel is allowed specifically for invalidation isolation, caching derived collections, or coarsening high-frequency geometry/scroll values; keep business logic in injected services (principle-keep-the-core-pure).
- Keep screen-local UI state in
Design
@Observablemodels and view inputs for minimal invalidation (references/observable-patterns.md,references/structure.md):- Mark
@Observableclasses@MainActor(unlessSWIFT_DEFAULT_ACTOR_ISOLATIONis MainActor);@Observableis unsupported onactor. - Make
@Observablestored property types and collection element types (Array,Set,Dictionary)Equatableso generated setters skip no-op invalidations. - Pass narrow value-type inputs (only the fields a view reads or forwards). Flatten nested value-type structs stored on
@Observablemodels, and cache derived/filtered collections (viadidSetor.onChange(of:)) instead of recomputing.filter/.sortedinline inbody. - Never have row views index back into a parent
@Observablecollection (model.items[index]); pass narrow fields or persisted
- Mark
Установить swiftui-architecture в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл swiftui-architecture?
WHEN building SwiftUI views, managing state, setting up shared services, or making architectural decisions; NOT for UIKit or legacy patterns; provides pure SwiftUI data flow without ViewModels using @State, @Binding, @Observable, and @Environment.
Как установить скилл swiftui-architecture?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл swiftui-architecture запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic