iOS Refactoring & Design

Widely misunderstood by developers, “refactoring” isn’t rewriting. Disciplined refactoring is changing the design of your code in small, verified steps. In this way, design can be discovered. Listen to the code, it’ll guide you.

What is refactoring? It’s hard to visualize only from abstract descriptions. At Quality Coding, you’ll see how refactoring works in the context of real examples from iOS code.

Refactor Like a Pro

Refactoring isn’t an outcome. It’s a series of steps. So we can’t just look at code, we have to watch how it’s transformed.

Improving a Short, Smelly Method

Let’s look a single, short method. What’s wrong with it? How do we improve it?

Spike Solutions

What do you do when you don’t know what to do?

Refactoring Tests

Tests are code, too. Let’s not neglect refactoring tests.

Code Design

iOS developers usually think about “design” in terms of user experience, or visual design. But code also has design—or lack of design. It’s basically user experience, where the user is the developer and their teammates.

Refactoring Modern Swift

How should we go about refactoring modern Swift? Tasks, actors, async, and SwiftUI… can we improve their design while getting rapid automated feedback? Subscribe to the new series to get articles as they come!

Looking for in-depth examples of iOS refactoring?

Part III of my book iOS Unit Testing by Example: XCTest Tips and Techniques Using Swift focuses on refactoring a view controller:

  • Cleaning up messy code
  • Transforming to Model View View Model (MVVM)
  • Transforming to Model View Presenter (MVP)

The earlier parts covers foundational tools and skills of iOS unit testing, and how to test specific behaviors of iOS apps.

Older Refactoring & Design Articles

Mostly specific to Objective-C techniques…
















Jon Reid

Refactoring: I’ll say more

Hi, I’m Jon Reid, the founder of this website and the consultancy Quality Coding, Inc. I’ll say more here about my philosophy of refactoring and design, stay tuned.

Join Us & Never Miss an Article!

Want to make sure you get notified when I release my next article or video? Then sign up here to join my list of Quality Coding Insiders. You’ll receive email notifications whenever I release new content. Plus, you’ll get access to the test-oriented code snippets I use every day!

>