-
-
Notifications
You must be signed in to change notification settings - Fork 107
Code style (objc)
Thilo Molitor edited this page Sep 7, 2024
·
2 revisions
We currently use 4 spaces. Trailing whitespaces should be avoided.
if()
{
}
else if()
{
}
else
{
}
switch()
{
case 0:
break;
case 1:
break;
default:
unreachable(); // if the default case should never occur - MLConstants.h
}
Type* varName;
#define SHORT_PING 16.0
Use proper sounding names (should sound like a sentence with a lot of and
and some with
or having
.
To rename functions for swift export, use NS_SWIFT_NAME
-(NSNumber*) functionNameWithName1:(ParamType1) varName1 andName2:(ParamTypeWithPtr*) varName2
{
}
//this would be named isContactBlacklisted(forEncryption:) in Swift-land if we did not use NS_SWIFT_NAME to rename it
+(BOOL) isContactBlacklistedForEncryption:(MLContact*) contact NS_SWIFT_NAME(isContactBlacklistedForEncryption(_:));
NSLocalizedString(@"Some text that should be translated", @"a note for our translators");