Need help with refactor-the-mega-controller?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

450 Stars 35 Forks 16 Commits 2 Opened issues


Commits contain refactoring steps taken in my talk, "Let's Play: Refactor the Mega-Controller"

Services available


Need anything else?

Contributors list

# 24,491
14 commits
# 60,054
1 commit

Let's Play: Refactor the Mega-Controller

Hello! This project needs some explanation.

This is the companion source for a talk I've been giving under the same name. You can also watch a more "improvised" version of it I gave at Realm.

The idea is to take a highly-coupled, highly-ugly view controller implementation and to incrementally isolate, abstract, and test components of it, reducing dependencies of each piece along the way.

I've tried to use this project to demonstrate some of the architectural design principles I've been developing for Swift. The source probably won't make much sense outside of the context of the talk, but perhaps in time I'll annotate the source with docstrings so that it can be read on its own.

If you're reading this outside the context of my talk, I'll offer this caveat: all added layers of abstraction also add complexity. Not all of these steps will necessarily be worth it given the tradeoffs of your own project. This project attempts to demonstrate aggressive isolation for instructive purposes, but I don't always advocate that in practice.

How to read the refactorings

The progressive refactorings are represented in the Git history.

represents where the refactoring stopped. You'll want to step back to the first revision, then step forward to see how each step was refactored.

Now you try!

I did these refactorings pretty quickly. You should feel free to try your hand at cleaning up this awful view controller on your own; send me pull requests, and we'll chat about 'em!

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.