Swift 5.1: Access Control Cheat Sheet

// A module — a framework or an application — is
// a single unit of code distribution that can be
// imported by another module with import keyword

// Class accessible from other modules
public class AccessLevelsShowcase {

  // Property accessible from other modules
  public var somePublicProperty = 0

  // Property accessible from the module is contained into
  var someInternalProperty = 0

  // Property accessible from its own defining source file
  fileprivate func someFilePrivateMethod() {}

  // Property accessible from its enclosing declaration
  private func somePrivateMethod() {}

Leave a Reply

Your email address will not be published. Required fields are marked *