Examples:
var userID
var userId
var userIdentifier
I struggle with this about once per project and I don't see many discussions on it.
I think it's _always_ a special case and as long as it's consistent within a project I try not to think about it too much.
However, would love to hear how others think and if there's _any_ logical advantage to any one of these options over the others.
Apple appears to be favoring the identifier suffix, over the prior ID suffix.
Personally, I'm not a fan of the Id suffix.
I used to use camel case for abbreviations, so Id works for me. but if it's in the end of the name of a variable then ID is more readable i think
Apple does use the "Identifier" suffix ex reuseIdentifier, eventIdentifier and when abbreviating Apple uses the uppercase "ID", for example NSManagedObject has an objectID, CKNotification has a notificationID and subscriptionID, CKRecord has a createrUserRecordID etc.
I tend to stick with what @jawwad posted.
@jawwad is correct. userID (The Dropbox SDK gets it wrong. :] )
Generally acronyms should be avoided but, The Apple API Design Guide says:
Acronyms and initialisms that commonly appear as all upper case in American English should be uniformly up- or down-cased according to case conventions:
var utf8Bytes: [UTF8.CodeUnit]
var isRepresentableAsASCII = true
var userSMTPServer: SecureSMTPServer
Will include mention under naming.
Most helpful comment
Apple does use the "Identifier" suffix ex
reuseIdentifier,eventIdentifierand when abbreviating Apple uses the uppercase "ID", for exampleNSManagedObjecthas anobjectID,CKNotificationhas anotificationIDandsubscriptionID,CKRecordhas acreaterUserRecordIDetc.