Refactoring Swift: A Catalog of 10 Essential Practices for Code Improvement
Mohamed Rafat, Mohammed El‐Ramly, Lamia Abo Zaid
Key points
From the paper's conclusion- We validated the proposed catalog through an exploratory expert survey with 16 Swift developers.
Abstract
Code refactoring is crucial for maintaining a clean and efficient codebase, thereby enhancing readability, reducing complexity, and improving maintainability. Refactoring catalogs provide a grouping of frequent and crucial refactorings, making available reusable solutions to recurring problems. Despite its popularity, Swift lacks such a standardized resource. Furthermore, Swift code undergoes frequent updates due to the rapid pace associated with mobile application development. This practice necessitates refactoring to maintain code quality. However, the lack of a standardized resource for refactoring leads to inconsistent, ad hoc practices among developers, potentially resulting in more harm than good. This paper addresses this gap by introducing a Swift‐specific refactoring catalog derived from an empirical analysis of 10 popular open‐source Swift repositories. Through this analysis, we identified and documented the most essential recurrent refactoring types that leverage Swift‐specific features, such as protocols and extensions. Each entry in the catalog is presented in a structured format: a clear problem context, a step‐by‐step solution, and a “before‐and‐after” code example, supplemented by design diagrams. We validated the proposed catalog through an exploratory expert survey with 16 Swift developers. The results strongly confirm the catalog's value. The expert panel validated the importance, clarity, and significance of the presented refactorings and confirmed a broad consensus on their effectiveness and value in enhancing overall code quality. This work provides a practical, validated resource to help Swift developers improve code quality and maintainability.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- From Custom Logic to APIs: Understanding and Recommending API Replacement RefactoringsProceedings of the ACM on Software Engineering · 2026
- Software Refactoring Research with Large Language Models: A Systematic Literature ReviewarXiv · 2026
- Multi-Agent Coordinated Method-Level Refactoring of Rust CodearXiv · 2026
- A Survey of Deep Learning Based Software RefactoringACM Computing Surveys · 2026
- Refactoring architectural smells with large language models: an exploratory study on cyclic dependenciesEmpirical Software Engineering · 2026
- Formalizing and Automating Fine-Grained Move Refactorings Across MethodsarXiv · 2026