in src/objc-renderer.ts [815:902]
function headerClassSection(classInfo: ObjC.Class): string {
const macros = classMacros(classInfo);
const prefixClassMacrosSection: string = codeSectionForCodeString(
macros.map(toPrefixMacroString).join('\n'),
);
const classComments = classInfo.comments.map(toCommentString).join('\n');
const classCommentsSection =
codeSectionForCodeStringWithoutExtraSpace(classComments);
const covariantTypesStr = covariantTypesString(classInfo.covariantTypes);
const implementedProtocolsStr = implementedProtocolsString(
classInfo.implementedProtocols,
);
const subclassingRestrictedStr = classInfo.subclassingRestricted
? '__attribute__((objc_subclassing_restricted))\n'
: '';
const visibility =
classInfo.visibility != null
? visibilityAttributeForVisibility(classInfo.visibility)
: '';
const classSection =
'@interface ' +
classInfo.name +
covariantTypesStr +
' : ' +
classInfo.baseClassName +
implementedProtocolsStr;
const inlinedBlocksStr: string = classInfo.inlineBlockTypedefs
.filter(blockTypeIsPublic(true))
.map(toBlockTypeDeclaration)
.join('\n');
const inlinedBlocksSection: string =
codeSectionForCodeString(inlinedBlocksStr);
const instanceVariablesStr: string = classInfo.instanceVariables
.filter(headerNeedsToIncludeInstanceVariable)
.reduce(buildInstanceVariablesContainingAccessIdentifiers, [])
.map(StringUtils.indent(2))
.join('\n');
const instanceVariablesSection: string =
instanceVariablesStr !== ''
? '{\n' + instanceVariablesStr + '\n}\n\n'
: '\n';
const propertiesStr = classInfo.properties.map(toPropertyString).join('\n');
const propertiesSection = codeSectionForCodeString(propertiesStr);
const implementedProtocols = implementedProtocolsIncludingNSObjectAndADTInit(
classInfo.implementedProtocols,
);
const classMethodsStr = classInfo.classMethods
.filter((method) => includeMethodInHeader(implementedProtocols, method))
.map(toClassMethodHeaderString)
.join('\n\n');
const classMethodsSection = codeSectionForCodeString(classMethodsStr);
const instanceMethodsStr = classInfo.instanceMethods
.filter((method) => includeMethodInHeader(implementedProtocols, method))
.map(toInstanceMethodHeaderString)
.join('\n\n');
const instanceMethodsSection = codeSectionForCodeString(instanceMethodsStr);
const postfixClassMacrosSection: string =
precedingTwoSpacePaddingForCodeString(
macros.map(toPostfixMacroString).join('\n'),
);
return (
prefixClassMacrosSection +
classCommentsSection +
subclassingRestrictedStr +
visibility +
classSection +
'\n' +
instanceVariablesSection +
propertiesSection +
inlinedBlocksSection +
classMethodsSection +
instanceMethodsSection +
'@end' +
postfixClassMacrosSection
);
}