You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating new types to host global constants and functions, prefer caseless enumerations to using structs. Enums are the conventional approach used by the Swift core team. Unlike caseless enumerations, structs can be instantiated by an API client.
Provide several examples of what would and wouldn't trigger violations.
// should triggerstructMath{publicstaticletpi= 3.14
}classMath{publicstaticletpi= 3.14
}structMath{publicstaticletpi= 3.14
@available(*, unavailable)init(){}}// shouldn't trigger// enumenumMath{publicstaticletpi= 3.14
}// class visible to Objective-CclassMath:NSObject{publicstaticletpi= 3.14
}// type with non-static declarationsstructMath{publicstaticletpi= 3.14
publicletrandomNumber=2}
Should the rule be configurable, if so what parameters should be configurable?
Just on the severity.
Should the rule be opt-in or enabled by default? Why?
See README.md for guidelines on when to mark a rule as opt-in.
Enabled by default.
The text was updated successfully, but these errors were encountered:
New Issue Checklist
Rule Request
If a type only exists to group global (
static
) functions and variables, it should be anenum
to avoid being instantiated.the community thinks about this.
From Erica Sadun's Swift Style book:
Just on the severity.
See README.md for guidelines on when to mark a rule as opt-in.
Enabled by default.
The text was updated successfully, but these errors were encountered: