Test or Go Fishing!
Test or Go Fishing!
a guide on how to write better Swift for iOS using Test Driven Development
About the Book
This book is aimed at developers of all skills. Beginners will enjoy a gentle introduction into the tools and language as well as practical examples to understand tricky concepts. If this is the first time you've ventured outside PHP then you'll need to work extra hard to forget it.
Obviously, being already skilled in another serious programming language will help immensely. Advanced iOS developers will also benefit from revisiting the basics. Moreover, the structure of this book will encourage them to take a step back and think about how they build their apps and the things they take for granted.
Chapter 1. Introduction 7
1.1 Why another iOS book 7
1.2 Audience & technologies 7
1.3 The title 8
1.4 Feedback 8
Chapter 2. Huh?! Testing? 9
2.1 What is Test-Driven Development? 9
2.2 Feature, Red, Green, Refactor 10
2.3 Testing in iOS 12
2.4 Still a debatable topic 14
Chapter 3. The Plan 16
3.1 Our end goal 16
3.2 MVC, MVP, MVVM 16
3.3 System components 19
3.4 Last piece of the puzzle: interface prototyping 21
3.5 Tasks list screen 22
Chapter 4. The Task 24
4.1 TDD in Xcode Playgrounds 24
4.2 A first test: tasks can be created 25
4.3 setUp() and tearDown() 27
4.4 Requirement: a task must have a name 29
4.5 Requirement: a task can have a due date 31
4.6 Requirement: a task can be completed 32
Chapter 5. The TaskManager 36
5.1 Requirement: has a task manager 36
5.2 Requirement: manages tasks 37
5.3 Refactoring 40
5.4 TaskManager Singleton 44
5.5 Introducing Realm 49
5.6 Task persistence 57
5.7 The complete source 59
Chapter 6. Migrating to an Xcode project 63
Appendix A – Apple development environment 64
Appendix B – Swift and the iOS SDKs 64
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.