How to use the apollo-codegen-swift.generateSource function in apollo-codegen-swift

To help you get started, we’ve selected a few apollo-codegen-swift examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apollographql / apollo-tooling / packages / apollo / src / generate.ts View on Github external
if (outputPath.split(".").length <= 1 && !fs.existsSync(outputPath)) {
    fs.mkdirSync(outputPath);
  }

  if (target === "swift") {
    options.addTypename = true;
    const context = compileToIR(schema, document, options);

    const outputIndividualFiles =
      fs.existsSync(outputPath) && fs.statSync(outputPath).isDirectory();

    const suppressSwiftMultilineStringLiterals = Boolean(
      options.suppressSwiftMultilineStringLiterals
    );

    const generator = generateSwiftSource(
      context,
      outputIndividualFiles,
      suppressSwiftMultilineStringLiterals,
      only
    );

    if (outputIndividualFiles) {
      writeGeneratedFiles(generator.generatedFiles, outputPath, "\n");
      writtenFiles += Object.keys(generator.generatedFiles).length;
    } else {
      fs.writeFileSync(outputPath, generator.output.concat("\n"));
      writtenFiles += 1;
    }

    if (options.generateOperationIds) {
      writeOperationIdsMap(context);

apollo-codegen-swift

Swift generator module for Apollo Codegen

MIT
Latest version published 3 years ago

Package Health Score

64 / 100
Full package analysis

Popular apollo-codegen-swift functions

Similar packages