Prompt
Names should clearly and accurately reflect the purpose of variables, methods, and other identifiers. Follow these principles:
- Use descriptive, specific names that convey exact purpose
- For booleans, prefer positive phrasing with ‘is’ prefix when appropriate
- Update names when functionality changes
- Follow established platform conventions (e.g., AppKit notification naming patterns)
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(...)