swift-refactor

Refactors Swift/SwiftUI codebases to the iOS 26 Swift 6.2 clinic modular MVVM-C architecture.

193|17|Updated Jan 16, 2026
One-click install
npx skills add https://github.com/pproenca/dot-skills --skill swift-refactor
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-refactor
Source: https://github.com/pproenca/dot-skills/tree/main/skills/.experimental/swift-refactor
Command: npx skills add https://github.com/pproenca/dot-skills --skill swift-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and assets (resource) components.

What problem does it solve?

This Skill addresses the challenges of maintaining and scaling Swift and SwiftUI applications by providing a structured approach to refactoring towards a modern, modular architecture. It helps eliminate outdated patterns and enforces best practices for performance, testability, and maintainability.

Core Features & Use Cases

  • Architecture Migration: Guides the transition from older SwiftUI patterns to the @Observable macro, NavigationStack, and coordinator-based navigation.
  • Modularization: Enforces clear boundaries between Domain, Data, and Feature modules using Swift Package Manager.
  • Performance Optimization: Focuses on view diffing, state management, and list performance improvements.
  • Use Case: Refactor a legacy SwiftUI app using ObservableObject and NavigationView into a clean, modular MVVM-C architecture using @Observable and NavigationStack, ensuring better performance and easier maintenance.

Quick Start

Apply the swift-refactor skill to modernize your existing SwiftUI code to the clinic architecture.

Frequently Asked Questions about swift-refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor SwiftUI code to use the @Observable macro and MVVM-C architecture?

Migrating to @Observable and MVVM-C architecture transitions legacy SwiftUI apps away from ObservableObject and NavigationView. It enforces @Observable ViewModels, coordinator-based navigation, and App-target DependencyContainers using Swift Package Manager boundaries.

What is the best way to modularize a legacy iOS app using Swift Package Manager?

The best way to modularize a legacy iOS app is enforcing clear boundaries between Domain, Data, and Feature modules using Swift Package Manager. This structured refactoring approach eliminates outdated patterns to improve testability and maintainability.

Why does my SwiftUI app need coordinator-based navigation and route shells?

Coordinator-based navigation and route shells are needed to scale SwiftUI applications effectively. They provide structured error-routing protocols and separate navigation logic from views, enforcing best practices for performance and testability during architecture migration.

Can I use this MVVM-C refactoring approach for Swift 6.2 and iOS 26 codebases?

Yes, this MVVM-C refactoring approach specifically targets Swift 6.2 and iOS 26 codebases. It aligns applications with the clinic modular architecture, enforcing Domain repository protocols and Data-owned I/O with stale-while-revalidate boundaries.

How do I handle state management and view diffing performance when migrating to modern SwiftUI?

Handling state management and view diffing performance requires migrating to the @Observable macro and NavigationStack. This refactoring focuses on view diffing, state management, and list performance improvements within a modular MVVM-C architecture.

What are the limitations of refactoring existing SwiftUI code into a strict modular MVVM-C architecture?

A limitation of strict modular MVVM-C architecture is the required migration of all outdated patterns to enforce specific boundaries. You must implement repository protocols, coordinator error-routing, and optimistic queued sync boundaries, which may require significant codebase restructuring.