Names should clearly and accurately reflect the purpose of variables, methods, and other identifiers. Follow these principles: 1. Use descriptive, specific names that convey exact purpose
Names should clearly and accurately reflect the purpose of variables, methods, and other identifiers. Follow these principles:
Example 1: Instead of:
var macosHidden: Bool
Use:
var isAppIconHiddenFromMacOS: Bool
Example 2: When a function’s responsibility expands:
// Before: only hides elements
func hideCustomTabBarViews() {
// hide some elements
}
// After: both hides and shows elements
func resetCustomTabBarViews() {
// hide some elements
// show other elements
}
Example 3: For notification naming, follow consistent patterns:
// Avoid inconsistent patterns
static let ghosttyToggleMaximize = Notification.Name(...)
// Follow "[Subject] [Event (past participle)]" pattern
static let ghosttyFullscreenDidToggle = Notification.Name(...)
Enter the URL of a public GitHub repository