Swift

Swift

Made by DeepSource

Follow conventions while naming types SW-C1000

Style
Minor

Type names in Swift should follow a specific convention to ensure consistency and readability of the codebase. In particular, type names should

  • only contain alphanumeric characters,
  • start with an uppercase character
  • span between 3 and 40 characters in length
  • private types may start with an underscore

Not following this convention leads to inconsistent and confusing code, making it harder to read and maintain. It can also cause issues with interoperability with other languages and systems.

To fix this issue, rename the type to follow the naming convention as mentioned above.

Bad Practice

class my123 {}
enum _Color {}
struct myStruct {}

Recommended

class MyClass {}
enum Color {}
struct MyStruct {}