{"id":13750743,"url":"https://github.com/SwiftGen/SwiftGenPlugin","last_synced_at":"2025-05-09T16:31:41.376Z","repository":{"id":49686173,"uuid":"517823425","full_name":"SwiftGen/SwiftGenPlugin","owner":"SwiftGen","description":"SwiftGen plugin for SPM","archived":false,"fork":false,"pushed_at":"2024-08-11T08:48:07.000Z","size":34,"stargazers_count":93,"open_issues_count":18,"forks_count":62,"subscribers_count":5,"default_branch":"stable","last_synced_at":"2024-11-14T11:16:16.924Z","etag":null,"topics":["spm","swift","swiftpackagemanager"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwiftGen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-25T21:17:43.000Z","updated_at":"2024-11-13T22:09:31.000Z","dependencies_parsed_at":"2023-01-22T02:01:09.632Z","dependency_job_id":null,"html_url":"https://github.com/SwiftGen/SwiftGenPlugin","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftGen%2FSwiftGenPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftGen%2FSwiftGenPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftGen%2FSwiftGenPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftGen%2FSwiftGenPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiftGen","download_url":"https://codeload.github.com/SwiftGen/SwiftGenPlugin/tar.gz/refs/heads/stable","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224608915,"owners_count":17339785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["spm","swift","swiftpackagemanager"],"created_at":"2024-08-03T08:00:45.841Z","updated_at":"2024-11-16T02:31:32.344Z","avatar_url":"https://github.com/SwiftGen.png","language":"Ruby","funding_links":[],"categories":["Frameworks with plugins"],"sub_categories":[],"readme":"# SwiftGenPlugin\n\nSwiftGen code generation for Swift packages that works on any machine. No installation required, simply add the package to your `Package.swift`'s dependencies:\n\n```swift\n  dependencies: [\n    .package(url: \"https://github.com/SwiftGen/SwiftGenPlugin\", from: \"6.6.0\")\n  ]\n```\n\n## Using it as a (pre-)build tool\n\nAdding SwiftGen as a prebuild tool will execute it and generate your files **before each build**.\n\n### Add to Package.swift\n\nAfter adding the dependency to your `Package.swift`, include the `SwiftGenPlugin` plugin in any targets for which you would like it to run.\n\n```swift\n  targets: [\n    .target(\n      name: \"YourTargetName\",\n      dependencies: [],\n      plugins: [\n        .plugin(name: \"SwiftGenPlugin\", package: \"SwiftGenPlugin\")\n      ]\n    )\n  ]\n```\n\n### Add a SwiftGen config\n\nAdd a `swiftgen.yml` file to your project following the [configuration file format](https://github.com/SwiftGen/SwiftGen/blob/stable/Documentation/ConfigFile.md), and prefix each of your output paths with `${DERIVED_SOURCES_DIR}/`. Or set this globally in your configuration by setting the `output_dir` to that value.\n\nTake a look at this repository's [swiftgen.yml](./Examples/top-level-swiftgen.yml) for an example.\n\n### Supporting Multiple Targets\n\nEach time the plugin is invoked it will look for a `swiftgen.yml` configuration file in 2 places:\n\n1. The root of your package (same folder as `Package.swift`).\n2. Your target's folder, for example `Sources/MyExample`.\n\nIt will invoke SwiftGen for each found configuration file, so you could choose either option, or combine both. This can be useful if you need some target-specific configuration and some shared configuration, without repeating yourself.\n\nDo note that the paths (to resources) in a configuration will need to change depending on where the configuration is located:\n\n1. Root configurations will need the full path to resources, such as `Sources/MyExample/Resources/Localizable.strings`. Or set the config's `input_dir` to `Sources/MyExample/Resources`. See an [example of a top-level configuration](./Examples/top-level-swiftgen.yml).\n2. Target configurations will need the relative path to resources, such as `Resources/Localizable.strings`. Or set the config's `input_dir` to `Resources`. See an [example of a target specific configuration](./Examples/target-specific-swiftgen.yml).\n\n## Using it as a command\n\nYou can **manually** invoke SwiftGen using the following command:\n\n```bash\nswift package --allow-writing-to-package-directory generate-code-for-resources\n```\n\nThe command will automatically search for `swiftgen.yml` configuration files in each of your targets' (or top-level) folder, and invoke SwiftGen for them.\n\nIf you want to manually provide the configuration file and other settings, pass them along as extra arguments:\n\n```bash\nswift package --allow-writing-to-package-directory generate-code-for-resources --config MyConfig.yml\n```\n\n---\n\n# Licence\n\nThis code and tool is under the MIT Licence. See the `LICENCE` file in this repository.\n\n## Attributions\n\nThese plugins are powered by [SwiftGen](https://github.com/SwiftGen/SwiftGen).\n\n\nIt is currently mainly maintained by [@AliSoftware](https://github.com/AliSoftware) and [@djbe](https://github.com/djbe). But I couldn't thank enough all the other [contributors](https://github.com/SwiftGen/SwiftGen/graphs/contributors) to this tool along the different versions which helped make SwiftGen awesome! 🎉\n\nIf you want to contribute, don't hesitate to open a Pull Request, or even join the team!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftGen%2FSwiftGenPlugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSwiftGen%2FSwiftGenPlugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSwiftGen%2FSwiftGenPlugin/lists"}