Member-only story
Namespacing in Swift
Which scope are you talking about?
You can have multiple functions that have the same name. There are some situations where you would probably actually want to do that.
This article explores Namespacing in Swift.
Difficulty: Beginner | Easy | Normal | Challenging
Prerequisites:
- Be able to produce a “Hello, World!” iOS application (guide HERE)
- Some knowledge of encapsulation (guide HERE)
- Knowledge of structs and classes (guide HERE)
- Knowledge of Access Control is useful when Frameworks are invovled later in the article (guide HERE)
Terminology
Frameworks: A way of sharing a package of code with Apps, team members or further afield
Module: A framework or application built and shipped as a single unit that can be imported by another module with Swift’s import keyword. Equivalent to node modules, packages, gems or jars in other languages
Namespace: A named region of a program used to group variables, types and methods
Struct: An object defined in Swift, using pass by value semantics