When creating a new Swift file inside a Swift Package, Xcode skips the filename prompt and generates an empty file without a header. This breaks consistency across projects and slows down development.
This custom file template restores the filename dialog and adds a standard header comment to new Swift files inside Swift Packages.
- Copy the
Swift Package File.xctemplatefolder to:[path_to_Xcode]/Contents/Developer/Library/Xcode/Templates/File Templates/MultiPlatform/Source. - Restart Xcode.
- Try to create new File.
- Choose
Swift Package File. - Enter the desired filename and location inside your Swift Package.
- A new Swift file will be created with the standard header.
Happy coding! 🚀