These guidelines applied to all CocoaHeads Russia projects.
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
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
).
- Protocols that describe what something is should read as nouns (e.g.
- 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)
- Extensions must be named as follow:
Project structure must match file 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)
)