S01E21: [TDD 🍅 18] Testing Presenters in Swift pt.2

In this episode, we finish test-driving the ResultsPresenter and QuestionPresenter implementations.

To provide a good user experience, we test-drive a very important factor for the result presentation: order! Yes, order matters for the players, so it is essential to test it as well.

Furthermore, we quickly test-drive a QuestionPresenter implementation as we discuss our preference for using if vs guard statements.

We decided to build the Presenters as structs rather than classes, since there’s no mutation involved in the mapping process, but we also discuss how the Presenter layer could be just a collection of pure functions. It’s up to you, as an engineer, to decide the best option for your project.

Finally, we use the newly created QuestionPresenter to assist the QuestionViewController configuration tests in the concrete view controller factory implementation. Red-green-refactor!

Subscribe now to our Youtube channel and catch free new episodes every week and follow along the project’s progress on GitHub.


Originally published at www.essentialdeveloper.com.

Let’s connect

If you enjoyed this article, visit us at https://essentialdeveloper.com and get more in-depth tailored content like this.

Follow us on: YouTubeTwitterFacebookGitHub

Essential Developer — iOS

Skilled, disciplined and professional iOS software development resources tailored for you. Join us https://essentialdeveloper.com

Essential Developer

Written by

Skilled, disciplined and professional iOS development resources tailored for you. Join us https://essentialdeveloper.com

Essential Developer — iOS

Skilled, disciplined and professional iOS software development resources tailored for you. Join us https://essentialdeveloper.com

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade