Skip to content

Latest commit

 

History

History
40 lines (25 loc) · 1.61 KB

code_style.md

File metadata and controls

40 lines (25 loc) · 1.61 KB

Code Style

These guidelines applied to all CocoaHeads Russia projects.

Xcode and Swift Style Guidelines

We follow these guidelines in coding

  • Don't use acronyms and abbreviations
  • Use indentation == 2 in for Tab width and Indent width. In most cases it will already be applied in project .xcodeproj file or will applied in project setup by first run script.

Xcode → Preferences → Text Editing → Indentation

Indentations

Coding

iOS/macOS

Naming

  • Controller
    • Controller classes mustn't have application logic and can only be used for classes interaction
  • Protocols
    • Protocols that describe what something is should read as nouns (e.g. Collection).
    • Protocols that describe a capability should be named using the suffixes -able, -ible, or -ing (e.g. Equatable, ProgressReporting).
  • Extensions
    • Extensions must be named as follow: <Capitalized type name>+<Capitalized component name> (e.g. String+Localization).
    • Extensions must be placed in proper folders: extensions/<Capitalized framework name>/<Capitalized type name>/<Extension File> (e.g. extensions/Foundation/String/String+Localization.swift)

Project structure must match file structure

Project Structure

Fonts & Colors

  • Fonts must be assigned through enum UIFont.FontType (e.g. UIFont.appFont(.gothamProMedium(size: 14)))
  • The same with colors: enum UIColor.ColorType (e.g. UIColor(.grey))

Vapor