O'Reilly logo

iOS 9 SDK Development by Janie Clayton, Chris Adamson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating Tests

What we need to do is to write a test method that can access the twitterWebView property of the ViewController class. This actually presents a little bit of a hassle that we haven’t had to consider before. Swift considers all the classes in the PragmaticTweets target to be one module, and classes in a module can see each other’s properties and methods by default. However, PragmaticTweetsTests is a different target and thus a different module, so it cannot see the methods or properties of our app’s classes. We’ll have to fix that before we can test anything.

We can declare different levels of access for our classes and their members. Swift has three levels of access, set by special keywords:

Access modifierVisibility

public

Visible ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required