The Clean Architecture: An Example

Today, I’d like to take an example iOS app written with an MVC architecture and show you what the example would be with a Clean Swift architecture. The example I’ve chosen to use is the Quiz app from chapter 1 of the 3rd edition of iOS Programming: The Big Nerd Ranch Guide.

The Quiz is a simple app that is like flash cards. It looks like this:

The Show Answer button will reveal the answer to the question and tapping on the Next Question button will display the next question.

The MVC Example

Click here to download the source code for the MVC version from Big Nerd Ranch’s site. The code is actually from the 6th edition.

Let’s look at the relevant code. Here’s the code for the view controller, ViewController.swift: Continue reading →

The Clean Architecture: An Introduction

In the last post, I talked about various architectures used as alternatives to MVC, in a attempt to solve MVCs problems, such as Massive View Controller.

In this post, I would like to introduce you to another architecture, which seems to me to be the best starting point for your app’s architecture: the Clean Architecture.

Continue reading →