Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
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

You're reading from   Test-Driven iOS Development with Swift Create fully-featured and highly functional iOS apps by writing tests first

Arrow left icon
Product type Paperback
Published in Feb 2016
Publisher Packt
ISBN-13 9781785880735
Length 218 pages
Edition 1st 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.instantiateViewControllerWithIdentifier(
        "DetailViewController") as! DetailViewController
}

At this point, we have to stop writing the...

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