Skip to content

Conversation

@johnbute
Copy link
Contributor

@johnbute johnbute commented Oct 2, 2025

Motivation:

Currently, SwiftPM supports a handful of hardcoded templates that act as a starting point for user projects. These built-in templates, accessible via swift package init, allow users to initialize basic packages such as libraries, tools, executables, and macros. While swift package init remains valuable for initializing simple packages, many Swift developers face more complex requirements when starting a new project, whether that may be initializing an HTTPS server or creating a package that implements an OpenAPI specification. These more complex package initializations have to be achieved through third-party command-line tools or custom scripts, many of which operate outside the SwiftPM ecosystem. This disconnect increases the complexity and makes it harder for users to discover, share, or customize initialization workflows.

Modifications:

Modifying Package.swift to store template metadata, added template utilities, new init function that supports old workflow and new template workflow, test template function, prompting system. Added show-templates function.

Result:

Now, users can initialize packages based on templates from local disk, git, or registry. Furthermore, they can author templates and test them with test template. For more, read documentation.

cmcgee1024 and others added 30 commits June 6, 2025 15:45
Fix show-executables subcommand so that it does not show templates
Use in-process API to run experimental dump help and decode JSON
…duct_types

Reduce changes compared to SwiftPM main branch
Add instructions to the SwiftPM readme for trying out templates
Copy link
Member

@heckj heckj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core docs review and wording suggestions

johnbute and others added 28 commits December 11, 2025 10:57
Co-authored-by: Joseph Heck <[email protected]>
@johnbute
Copy link
Contributor Author

@swift-ci please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.