Adhere to the established naming conventions and namespacing practices of your target platform. This includes following language-specific patterns for method names, avoiding namespace pollution in headers, and properly namespacing exported functions.
Adhere to the established naming conventions and namespacing practices of your target platform. This includes following language-specific patterns for method names, avoiding namespace pollution in headers, and properly namespacing exported functions.
For Objective-C:
get
should return results via pointer arguments, not return values directlyRCT
prefix)using namespace
declarations in header files to prevent namespace pollutionExample violations and fixes:
// ❌ Violates Objective-C naming convention
+ (std::pair<CGPoint, CGPoint>)getPointsForCAGradientLayerLinearGradient:(CGPoint)startPoint
// ✅ Follows convention by removing 'get' prefix
+ (std::pair<CGPoint, CGPoint>)pointsForCAGradientLayerLinearGradient:(CGPoint)startPoint
// ❌ Missing namespace prefix for exported function
RCT_EXTERN RCTFontWeight weightOfFont(UIFont *font);
// ✅ Properly namespaced
RCT_EXTERN RCTFontWeight RCTGetFontWeight(UIFont *font);
Platform naming conventions exist for good reasons - they improve code readability, prevent naming conflicts, and ensure consistency with the broader ecosystem.
Enter the URL of a public GitHub repository