Type Naming Convention

ID

swift.naming_class

Severity

info

Remediation Complexity

trivial

Remediation Risk

medium

Remediation Effort

low

Resource

Naming Convention

Language

Swift

Tags

naming

Description

Reports type declaration names — class, struct, enum, protocol, actor, typealias — that do not follow Swift’s UpperCamelCase convention.

Rationale

Swift’s API design guidelines specify that types use UpperCamelCase. Lowercase initial letters and underscores break consistency with the standard library and confuse readers about whether a name refers to a type, a value or a function.

// Bad
class my_class {}
struct point {}

// Good
class MyClass {}
struct Point {}

Exceptions

Extensions are not visited — they name an existing type rather than introducing a new one.

Parameters

classNamePattern

Regular expression a type name must match. Defaults to ^[A-Z][a-zA-Z0-9]*$.

Remediation

Rename the type using UpperCamelCase. Remove underscores and make the first character uppercase.