Swiftpack.co - fulldecent/swift5-module-template as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
An opinionated starting point for awesome, reusable Swift 5 modules
.package(url: "https://github.com/fulldecent/swift5-module-template.git", from: "12.3.12C33")

Build Status

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 12.4 (12D4e)

Swift 5 Module directory layout


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 using SwiftUI

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
__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 ./configure.

How it works

┌─────────────┐              ┌─────────────┐              ┌─────────────┐
│     Use     │              │    Save     │              │Use your own │
│    Xcode    │─Save recipe─▶│  template   │─./configure─▶│   module    │
└─────────────┘              └─────────────┘              └─────────────┘
       ▲              ▲             ▲               ▲            ▲       
       │              │             │               │            │       
        Contributors to this project          End users of this project


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.


Stars: 363
Last commit: 24 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

Support SwiftUI and Xcode 12.3
39 weeks ago

These new instructions support the latest version of Xcode.

Now the iOS Example application is using SwiftUI.

Some bugs have been fixed in Xcode and we have removed those workaround notes.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics