Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Test-Driven iOS Development with Swift 4

You're reading from   Test-Driven iOS Development with Swift 4 Write Swift code that is maintainable, flexible, and easily extensible

Arrow left icon
Product type Paperback
Published in Oct 2017
Publisher Packt
ISBN-13 9781788475709
Length 222 pages
Edition 3rd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Dr. Dominik Hauser Dr. Dominik Hauser
Author Profile Icon Dr. Dominik Hauser
Dr. Dominik Hauser
Arrow right icon
View More author details
Toc

Implementing DetailViewController

We start the implementation of DetailViewController with the creation of a test case. Select the ToDoTests group in Project Navigator and go to iOS | Source | Unit Test Case Class. Let's name it DetailViewControllerTests, and select the Controller folder as the destination location. Import the @testable import ToDo main module and delete the two template test methods.

Going by the screenshots we've seen in Chapter 2, Planning and Structuring Your Test-Driven iOS App, we know that DetailViewController needs a map view, four labels, and a button. Here, we will only show the TDD process for one label and the button. Add the following code to DetailViewControllerTests:

func test_HasTitleLabel() { 
  let storyboard = UIStoryboard(name: "Main", 
                                bundle: nil) 
  let sut = storyboard 
    .instantiateViewController...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image