Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 940 Bytes

Naming.md

File metadata and controls

25 lines (20 loc) · 940 Bytes

Naming

General Guidelines

Follow the official Swift API Design Guidelines section on naming.

UI Components

When naming types and instances of views, view controllers, layers, and other components of the user interface, include type information in the name of the type and instance to disambiguate from non-user interface data at usage sites.

Examples

let name: UITextField // 🛑
name.delegate = self // Unclear at usage.

let nameTextField: UITextField // ✅
nameTextField.delegate = self // Clear at usage.
final class Settings: UIViewController { } // 🛑
let settings = Settings() // 🛑
show(settings, sender: self) // Unclear at usage.

final class SettingsViewController: UIViewController { } // ✅
let settingsViewController = SettingsViewController() // ✅
show(settingsViewController, sender: self) // Clear at usage.