Swift: Global constant naming convention?
Swift 3 API guidelines state that "Names of types and protocols are UpperCamelCase. Everything else is lowerCamelCase."
https://swift.org/documentation/api-design-guidelines/
Ideally your global constants will be located within a struct of some sort, which would be UpperCamelCase, and all properties in that struct would be lowerCamelCase
struct LoginConstants { static let maxAttempts = 10}
And accessed like so,
if attempts > LoginConstants.maxAttempts { ...}
I've been debating using camel case with a leading capital for class-level constants. For example:
static let MaximumNumberOfLoginAttempts = 10
It's still camel-case (as Apple appears to recommend), but the capitalized leading character makes it clear that the value is immutable.
Apple advocates the camelCase.That said, many use _camelCase just to differentiate it especially if you are likely to have the same name at a lower scope.