Zum Inhalt springen

Boolean Prefix (ARCH9007)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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.

var active: Bool = true
func premium() -> Bool { false }
var isActive: Bool = true
func hasPremium() -> Bool { false }

Prefix Bool members with is/has/can/should so conditions read as questions.