Swift-Coding-Guidelines icon indicating copy to clipboard operation
Swift-Coding-Guidelines copied to clipboard

A repository to collect best practices when programming with Swift

Swift Coding Guidelines

The following section describe a list of rules, code conducts and best practices used while working on iOS projects using Swift language. With the help of a set of shared guidelines and automated tools we aim to maintain a higher level of code discipline and increase the reliability of the code during the entire lifecycle of a project.

The following section describe tools and rules used into the project. In order to automate the check of the source code by identifying some common and uncommon mistakes SwiftLint tool is used and executed at each build of the project.

Index

  • Code Formatting
  • Naming Conventions
    • Naming Conventions for Code
    • File Naming Conventions
  • Coding Style
    • General Guidelines
    • Variables
    • Constants
    • Tuples
    • Access Modifiers
    • Custom Operators
    • Switch & Enums
    • Optionals
    • Protocols
    • Properties
    • Ternary Operator
    • Closures
    • Delegates
    • Array
    • Using guard
    • Error Handling
    • Unused Code
    • Importing Modules
    • Using of self
    • Classes or Structs
    • Loops
    • Documentation & Comments
  • Linter Rules

References

The following documents are used as base for this set of rules.