How to name a constant in Objective-C?

After a bit of googling I’ve found the official coding guidelines for Cocoa.

To sum up:

  • Start with a two- or three-letter prefix in ALL-CAPS
  • Rest in UpperCamelCase
  • Same criteria for extern constants

I agree with itaiferber that the k prefix style is clearer and also much more useful for autocompletion. It would be interesting to know if this style is more popular than the official guidelines.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)