Mastering macOS Programming
上QQ阅读APP看书,第一时间看更新

Naming of types and variables

By now, you'll probably have spotted the pattern, but here it is anyway:

TypeNames are written in CapitalizedCamelCase.

We use uncapitalizedCamelCase for variableNames and constantNames.

Swift is pretty relaxed about what characters you use for naming, but there are a few rules:

  • Names may not contain whitespace characters
  • Names may not contain math symbols, line-drawing characters, or arrows
  • Names may not begin with a number (but numbers are fine anywhere else in the name)
  • Names may not be the same as Swift keywords (actually, there is a way to do this, but just don't)