• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. title:: clang-tidy - objc-property-declaration
2
3objc-property-declaration
4=========================
5
6Finds property declarations in Objective-C files that do not follow the pattern
7of property names in Apple's programming guide. The property name should be
8in the format of Lower Camel Case.
9
10For code:
11
12.. code-block:: objc
13
14   @property(nonatomic, assign) int LowerCamelCase;
15
16The fix will be:
17
18.. code-block:: objc
19
20   @property(nonatomic, assign) int lowerCamelCase;
21
22The check will only fix 'CamelCase' to 'camelCase'. In some other cases we will
23only provide warning messages since the property name could be complicated.
24Users will need to come up with a proper name by their own.
25
26This check also accepts special acronyms as prefixes or suffixes. Such prefixes or suffixes
27will suppress the Lower Camel Case check according to the guide:
28https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingBasics.html#//apple_ref/doc/uid/20001281-1002931-BBCFHEAB
29
30For a full list of well-known acronyms:
31https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/APIAbbreviations.html#//apple_ref/doc/uid/20001285-BCIHCGAE
32
33The corresponding style rule: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-1001757
34
35The check will also accept property declared in category with a prefix of
36lowercase letters followed by a '_' to avoid naming conflict. For example:
37
38.. code-block:: objc
39
40   @property(nonatomic, assign) int abc_lowerCamelCase;
41
42The corresponding style rule: https://developer.apple.com/library/content/qa/qa1908/_index.html
43