iOS
Test-Driven
Development
by Tutorials
By Joshua Greene & Michael Katz
iOS Test-Driven Development by Tutorials
By Joshua Greene & Michael Katz
Copyright 2022 Razeware LLC.
Notice of Rights
All rights reserved. No part of this book or corresponding materials (such as text, images, or source code) may be reproduced or distributed by any means without prior written permission of the copyright owner.
Notice of Liability
This book and all corresponding materials (such as source code) are provided on an as is basis, without warranty of any kind, express of implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in action of contract, tort or otherwise, arising from, out of or in connection with the software or the use of other dealing in the software.
Trademarks
All trademarks and registered trademarks appearing in this book are the property of their own respective owners.
Book License
By purchasing iOS Test-Driven Development by Tutorials, you have the following license:
You are allowed to use and/or modify the source code in iOS Test-Driven Development by Tutorials in as many apps as you want, with no attribution required.
You are allowed to use and/or modify all art, images and designs that are included in this book in as many apps as you want, but must include this attribution line somewhere inside your app: Artwork/images/designs: from iOS Test-Driven Development by Tutorials, available at www.raywenderlich.com.
The source code included in iOS Test-Driven Development by Tutorials is for your personal use only. You are NOT allowed to distribute or sell the source code in iOS Test-Driven Development by Tutorials without prior authorization.
This book is for your personal use only. You are NOT allowed to sell this book without prior authorization, or distribute it to friends, coworkers or students; they would need to purchase their own copies.
All materials provided with this book are provided on an as is basis, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action or contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
All trademarks and registered trademarks appearing in this guide are the properties of their respective owners.
Before You Begin
This section tells you a few things you need to know before you get started, such as what youll need for hardware and software, where to find the project files for this book, and more.
What You Need
To follow along with this book, youll need the following:
Xcode 13 or later. Xcode is the main development tool for writing code in Swift. You need Xcode 13 at a minimum, since that version includes Swift 5.5. You can download the latest version of Xcode for free from the Mac App Store, here: apple.co/1FLn51R.
If you havent installed the latest version of Xcode, be sure to do that before continuing with the book. The code covered in this book depends on Swift 5.5 and Xcode 13 the code may not compile if you try to work with an older version.
Book Source Code & Forums
Where to download the materials for this book
The materials for this book can be cloned or downloaded from the GitHub book materials repository:
Forums
Weve also set up an official forum for the book at https://forums.raywenderlich.com/c/books/ios-test-driven-development-by-tutorials. This is a great place to ask questions about the book or to submit any errors you may find.
Dedications
For my girls. I love you very much.
Joshua Greene
Dedicated to the memory of my mother-in-law, Barbara Schwartz. Her selflessness and dedication to teaching inspires me to give back to the community and educate others.
Michael Katz
About the Authors
Joshua Greene is an author of this book. Hes an experienced software engineer and long-time member of the raywenderlich.com team. Hes created dozens of mobile apps, several books and hundreds of videos and tutorials about software development. When hes not slinging code, you can find him wandering the streets of Tokyo. You can reach him on Twitter @jrg_developer (https://twitter.com/jrg_developer).
Michael Katz is a champion baker. ;] Oh, hes also an author of this book, developer, architect, speaker, writer and avid homebrewer. He has contributed to several books on iOS development and is a long-time member of the raywenderlich.com tutorial team. He shares his home state of New York with his family, the worlds best bagels and the Yankees. When hes not at his computer, hes out on the trails, in his shop or reading a good book (like this one!).
About the Editors
Darren Ferguson is the final pass editor for this book. He is an experienced software developer and works for M.C. Dean, Inc, a systems integration provider from North Virginia. When hes not coding, youll find him enjoying EPL Football, traveling as much as possible and spending time with his wife and daughter.
April Rames is the editor of this book. April is a former high school English and theatre teacher and director. When not volunteering at her daughters schools, she usually spends her time being asked to pretend to be a unicorn, zombie princess or super hero. In her spare time, she enjoys reading, making pasta and exploring the Gulf Coast with her family.
Introduction
Welcome to iOS Test-Driven Development by Tutorials! This book will teach you all about test-driven development (TDD) the art of turning requirements into tests and tests into production code.
Youll get hands-on TDD experience by creating three real-world apps in this book:
By the end of this book, youll have a strong understanding of TDD and be able to apply this knowledge to your own apps.
Next page