Swift 5 Module Template
Use this template as a starting point for any Swift 5 module that you want other people to include in their projects.
STATUS: This template is ready and works in production code, compatible with Xcode 11.1 (11A1027)
Your new Swift 5 module will immediately have working, compilable code, and all these features:
- Ability to be used from Swift Package Manager, CocoaPods and Carthage
- Clean folder structure
- MIT license
- Testing as a standard
- Turnkey access to Travis CI
- Semantic versioning and a CHANGELOG
- Included example/demo app
We make the assumption you are using an Xcode project to manage your code.
How to use this
Clone or download a release and run the
./configure program. It will ask you some questions and generate a project.
Or if you have CocoaPods installed, you can alternatively use:
pod lib create --verbose --template-url='https://github.com/fulldecent/swift5-module-template.git' MyNewPodName
You then add all the interesting features you want your module to have.
Using CocoaPods to manage dependencies for your example app
You distribute an example app with your new Swift module to show that it works. You may also decide to add UI tests to your example app and some people like to use testing frameworks for those UI tests. If you would like to use CocoaPods to manage the dependencies of your example app, please see the discussion at https://github.com/fulldecent/swift5-module-template/issues/8.
Automating the configure script
To skip interactive prompts in the
./configure script, use these environment variables:
| Template variable | Environment variable |
| -------------------------------- | ---------------------------------------- |
__ORGANIZATION NAME__ |
__AUTHOR NAME__ |
__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. |
For example, you may use:
export SMT_ORGANIZATION_NAME='Awesome Org' before running
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.
You may find interesting
Support Objective-C - 2017-06-25 03:50:13
Now includes an Objective-C class. This now makes this project usable for Swift 3 modules and Objective-C modules.
Support Xcode 8.1 - 2016-12-04 21:38:38
- Now supports the latest Xcode 8.1
Bug fixes, new features - 2016-09-17 22:16:42
- Testing with the https://github.com/fulldecent/FDTake project
- Add CheckCocoaPodsQualityIndexes.rb testing
- Use .swift-version to fix builds with CocoaPods
- Fix problems in the template
Initial Public Release - 2016-09-16 03:37:07
- First public release. Everything works great.