Home

Awesome

Swift 6 Module Template

Use this template as a starting point for any Swift 6 module that you want other people to include in their projects.

STATUS: This template is ready and works in production code, compatible with Xcode Version 16.0 (16A242d)

Swift 5 Module directory layout

Features

Your new Swift module will immediately have working, compilable code, and implement these best practices:

How to use this

Clone or download a release and run the ./configure.rb program. It will ask you some questions and generate a project.

You then add all the interesting features you want your module to have.

Automating the configure script

To skip interactive prompts in the ./configure script, use these environment variables:

Template variableEnvironment variable
__PROJECT_NAME__SMT_PROJECT_NAME
__ORGANIZATION NAME__SMT_ORGANIZATION_NAME
com.AN.ORGANIZATION.IDENTIFIERSMT_COM_AN_ORGANIZATION_IDENTIFIER
__AUTHOR NAME__SMT_AUTHOR_NAME
__TODAYS_DATE__SMT_TODAYS_DATE
__TODAYS_DATE__ (date format)SMT_DATE_FORMAT_STRING Note: this will ask you for today’s date but it will use this format in the template.
__TODAYS_YEAR__SMT_TODAYS_YEAR
__GITHUB_USERNAME__SMT_GITHUB_USERNAME

For example, you may use: export SMT_ORGANIZATION_NAME='Awesome Org' before running ./configure.

How it works

graph LR
    subgraph Contributors to this project
    X[Use Xcode] --> R[Update Recipe.md]
    R --> T[Update template]
    end
    T --> C
    subgraph End users of this project
    C[Run ./configure.rb] --> M[Use your own module]
    end

Contributing

See the file Recipe.md for the complete steps (e.g. Open Xcode, make new project, click here, type that, …) of how we made the template.