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


Visible ...

Get iOS 9 SDK Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.