Skip to content

Latest commit

 

History

History

14-access-control

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Access Control

Swift provides five different access levels for entities within your code:

  • open - is the least restrictive. Anyone can subclass and override.
  • public - Anyone can subclass and override within module
  • internal - default, allows access within module
  • fileprivate - restricts entity to to its own defining source file (even outside the type)
  • private - limits to withing the type

Typically we use:

  • public / private / internal
  • seldom use open, fileprivate

Links that help