iOS - Is there any configuration that puts que generated output into a target as compile source?

Before 1.0, all generated code was inside the API.swift file and now its spread across the many generated operations. We used to simply let the API.swift as compile source and now we have to manually from add these to the project.

Is there any way to make it simpler as it was before? Like force to use back the API.swift or any strategy that automatically link the files to the schema.

In the documentation, there is this option called embeddedInTarget(name: String) but it has this note:
**Note:** When using this `moduleType` , you are responsible for ensuring the generated files are linked to your application target. I don’t understand.

1 Like

Hi @celtaheaven1 - :wave:

Like force to use back the API.swift or any strategy that automatically link the files to the schema.

No, there is no option to force the old behaviour of a single file. What you’re seeing is the improved support for multi-module architectures.

In the documentation, there is this option called embeddedInTarget(name: String) but it has this note:
**Note:** When using this moduleType , you are responsible for ensuring the generated files are linked to your application target. I don’t understand.

This means that you will have to manually add all the generated files to your project. That module type requires you to do the most manual work of adding files to your project. It’s done that way to support complex architectures and project configurations that we don’t have specific module types for.

Is there any way to make it simpler as it was before?

The simplest is probably to use the swiftPackageManager module type and then generate the operation models into that package too with the inSchemaModule option. That way you will have one Swift package which you add to your project as a dependency and code generation will handle the configuration of the package.