For the More Curious: Access Modifiers

As you have already seen in this chapter, Swift has a mechanism for controlling access to a class, method, or property – among other things. This is done via access modifiers, keywords which are applied to the entities whose visibility is being configured.

In Swift, there are three levels of visibility and three corresponding keywords by which the visibilities are specified:

internal

A class, method, or other entity which has internal visibility can be seen from all files inside the same module as the class. An entity with internal visibility cannot, however, be seen from files in a different module.

internal is the default level of visibility for an entity. When you first add a ...

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide 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.