43 lines · plain
1.. title:: clang-tidy - objc-property-declaration2 3objc-property-declaration4=========================5 6Finds property declarations in Objective-C files that do not follow the pattern7of property names in Apple's programming guide. The property name should be8in the format of Lower Camel Case.9 10For code:11 12.. code-block:: objc13 14 @property(nonatomic, assign) int LowerCamelCase;15 16The fix will be:17 18.. code-block:: objc19 20 @property(nonatomic, assign) int lowerCamelCase;21 22The check will only fix 'CamelCase' to 'camelCase'. In some other cases we will23only 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 prefixes27or suffixes will 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-BBCFHEAB29 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-BCIHCGAE32 33The corresponding style rule: https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-100175734 35The check will also accept property declared in category with a prefix of36lowercase letters followed by a '_' to avoid naming conflict. For example:37 38.. code-block:: objc39 40 @property(nonatomic, assign) int abc_lowerCamelCase;41 42The corresponding style rule: https://developer.apple.com/library/content/qa/qa1908/_index.html43