Swift supports following scopes:

  • modules scope - everything that declared inside module
  • class scope - everyhing that declared within class/structure/enum body
  • local scope - everything that declared within function or method body
  • block scope - anything declared within the curly brackets {}


A module is a single unit of code distribution—a framework or application that’s built and shipped as a single unit and that can be imported by another module with Swift’s import keyword.