function createClassesForObjectSpecType()

in src/pluggable-objc-file-creation.ts [628:704]


function createClassesForObjectSpecType<T>(
  typeInformation: T,
  typeName: string,
  comments: string[],
  baseClassName: string,
  functions: ObjC.Function[],
  plugins: List.List<ObjCGenerationPlugIn<T>>,
  nullability: ObjC.ClassNullability,
  visibility: ObjC.ClassVisibility | undefined,
): ObjC.Class[] {
  const classMethods = List.foldl<ObjCGenerationPlugIn<T>, ObjC.Method[]>(
    (soFar, plugin) => buildClassMethods(typeInformation, soFar, plugin),
    [],
    plugins,
  ).sort(sortInstanceMethodComparitor);

  const instanceMethods = List.foldl<ObjCGenerationPlugIn<T>, ObjC.Method[]>(
    (soFar, plugin) => buildInstanceMethods(typeInformation, soFar, plugin),
    [],
    plugins,
  ).sort(sortInstanceMethodComparitor);

  const properties = List.foldl<ObjCGenerationPlugIn<T>, ObjC.Property[]>(
    (soFar, plugin) => buildProperties(typeInformation, soFar, plugin),
    [],
    plugins,
  );

  const instanceVariables = List.foldl<
    ObjCGenerationPlugIn<T>,
    ObjC.InstanceVariable[]
  >(
    (soFar, plugin) => buildInstanceVariables(typeInformation, soFar, plugin),
    [],
    plugins,
  );

  const implementedProtocols = List.foldr<
    ObjCGenerationPlugIn<T>,
    ObjC.ImplementedProtocol[]
  >(
    (soFar, plugin) =>
      buildImplementedProtocols(typeInformation, soFar, plugin),
    [],
    plugins,
  );

  const classDefintionMaybe = createClassIfNecessary(
    classMethods,
    instanceMethods,
    properties,
    instanceVariables,
    functions,
    implementedProtocols,
    comments,
    typeName,
    baseClassName,
    nullability,
    List.foldr<ObjCGenerationPlugIn<T>, boolean>(
      (soFar, plugin) =>
        checkSubclassingRestricted(typeInformation, soFar, plugin),
      false,
      plugins,
    ),
    visibility,
  );

  return Maybe.match(
    function (classInfo) {
      return [classInfo];
    },
    function () {
      return [];
    },
    classDefintionMaybe,
  );
}