Autofilling certain configurations of a Swift Package in the Manifest file

Suggestions

For SwiftPM itself, there is an accepted proposal covering this area: SE-0500: Improving package creation with custom templates. It adds custom-template support to swift package init. The proposal was accepted with modifications, but the implementation has not landed in SwiftPM yet.

Since your question is specifically about creating packages through Xcode, the Xcode side is separate from the open-source SwiftPM command-line interface. There is currently no documented, supported Xcode setting for saving these defaults. I would suggest filing an enhancement request with the Xcode team through Feedback Assistant. You could also ask about possible workarounds on the Apple Developer Forums.

Advanced

As an unsupported workaround (DO NOT ASK ME FURTHER ON THIS), experienced users can experiment with Xcode’s template system. The built-in templates can be found under:

/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates

In the package case, it might be /Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates/Project Templates/MultiPlatform/Library/Library.xctemplate/TemplateInfo.plist

Use those as references rather than editing the Xcode application bundle directly. Custom templates are commonly kept under:

~/Library/Developer/Xcode/Templates

Xcode’s template format is not publicly documented by Apple and may change between releases, so this approach is version-dependent and may not support every Package.swift setting. There are third-party guides available online if you want to explore it.

1 Like