Boolean Prefix (ARCH9007)
Esta página aún no está disponible en tu idioma.
Key swift.naming.boolean-prefix · Severity info · Category naming
Flags Bool properties and functions whose name lacks an interrogative prefix (is/has/can/should/was/will/needs/contains/allows/supports). Cocoa delegate methods, which take their sender unlabelled and are named after it, and @discardableResult actions are excepted.
Incorrect
Section titled “Incorrect”var active: Bool = truefunc premium() -> Bool { false }Correct
Section titled “Correct”var isActive: Bool = truefunc hasPremium() -> Bool { false }Prefix Bool members with is/has/can/should so conditions read as questions.