skillfed

swift-refactor

swift-refactor helps developers modernize SwiftUI applications by transforming existing code into clean, modular MVVM-C patterns. It leverages Swift's @Observable macro and SPM package boundaries to create maintainable, scalable architectures that separate concerns and improve testability.

swift-refactor guides you through replacing deprecated ObservableObject patterns with Swift's @Observable macro. This modernization reduces boilerplate, improves performance through automatic view diffing, and aligns with current SwiftUI best practices. The skill helps you migrate state management to cleaner, more efficient implementations that work seamlessly with Swift 6.2 and later.

AI-generated summary based on this skill's SKILL.md

182 14 MIT updated by pproenca

Install

pproenca/dot-skills/swift-refactor · repository language: Shell

CLI (skillfed)coming soon
git clone https://github.com/pproenca/dot-skills
cp -r dot-skills/skills/.experimental/swift-refactor ~/.claude/skills/swift-refactor

Frequently asked questions

AI-generated answers based on this skill's SKILL.md and metadata

What modernization does swift-refactor apply to SwiftUI observable viewmodels?

swift-refactor guides you through replacing deprecated ObservableObject patterns with Swift's @Observable macro. This modernization reduces boilerplate, improves performance through automatic view diffing, and aligns with current SwiftUI best practices. The skill helps you migrate state management to cleaner, more efficient implementations that work seamlessly with Swift 6.2 and later.

How does swift-refactor structure code into modular MVVM-C architecture?

swift-refactor helps you refactor existing SwiftUI code into modular MVVM-C patterns using SPM package boundaries. It establishes clean architecture layers—Domain, Data, Feature, and App—with protocol-driven design. This separation enables independent feature development, easier testing, and scalable codebase organization across multiple Swift Package Manager modules.

Can swift-refactor help migrate from NavigationView to NavigationStack?

Yes. swift-refactor addresses the migration from deprecated NavigationView to modern NavigationStack. It shows how to implement coordinator-based navigation patterns and dependency injection alongside the new navigation APIs. This modernization improves navigation predictability and integrates cleanly with MVVM-C architectures.

What SwiftUI performance optimizations does swift-refactor cover?

swift-refactor improves SwiftUI performance through view diffing, composition extraction, and list optimization techniques. It teaches you to identify expensive view recomputations, break monolithic views into smaller components, and optimize collection rendering. These patterns reduce unnecessary updates and improve app responsiveness.

How does swift-refactor implement dependency injection in SwiftUI?

swift-refactor demonstrates dependency injection container patterns and coordinator-based navigation that work with modern SwiftUI. It shows how to inject dependencies at the feature and app layers, enabling testable, loosely-coupled components. This approach pairs naturally with SPM boundaries and protocol-driven design for maximum flexibility.

What license covers swift-refactor?

swift-refactor is released under the MIT license, allowing free use, modification, and distribution in both open-source and commercial projects with minimal restrictions.

SKILL.md

rendered from the published skill — quoted content, verbatim

Swift/SwiftUI Refactor (Modular MVVM-C)

Comprehensive refactoring guide for migrating Swift/SwiftUI code to modular MVVM-C with local SPM package boundaries and App-target composition root wiring.

Mandated Architecture Stack

``` ┌───────────────────────────────────────────────────────────────┐ │ App target: DependencyContainer, Coordinators, Route Shells │ ├───────────────────────────────────────────────────────────────┤ │ Feature modules: View + ViewModel (Domain + DesignSystem deps)│ ├───────────────────────────────────────────────────────────────┤ │ Data package: repositories, remote/local stores, sync, retry │ ├───────────────────────────────────────────────────────────────┤ │ Domain

(truncated - see the full file via the links below)

Read as markdown · JSON record · Browse the source repository

File tree — 15 files
skills/.experimental/swift-refactor/SKILL.md
skills/.experimental/swift-refactor/metadata.json
skills/.experimental/swift-refactor/references/_sections.md
skills/.experimental/swift-refactor/references/api-alert-confirmation-dialog.md
skills/.experimental/swift-refactor/references/api-environment-object-removal.md
skills/.experimental/swift-refactor/references/api-list-foreach-identifiable.md
skills/.experimental/swift-refactor/references/api-navigationstack-migration.md
skills/.experimental/swift-refactor/references/api-observable-macro.md
skills/.experimental/swift-refactor/references/api-onchange-signature.md
skills/.experimental/swift-refactor/references/api-toolbar-migration.md
skills/.experimental/swift-refactor/references/arch-environment-key-injection.md
skills/.experimental/swift-refactor/references/arch-feature-module-extraction.md
skills/.experimental/swift-refactor/references/arch-model-view-separation.md
skills/.experimental/swift-refactor/references/arch-protocol-dependencies.md
skills/.experimental/swift-refactor/references/arch-viewmodel-elimination.md

Related skills

Tags

architecture-migration state-modernization modular-design protocol-driven performance-tuning dependency-wiring layer-separation navigation-patterns async-patterns code-organization