Swiftpack.co - Package - AckeeCZ/tapestry


Build Status

What's Tapestry 🤔

Tapestry helps you with creating and managing your Swift frameworks 💫

Do you want to easily create a Swift framework that supports Carthage, Cocoapods and SPM?

Or define your release steps in a type-safe way?

Well, look no further, tapestry shall help you with exactly that!

Projects Using Tapestry

| Project | Repository | | -------- | -------------------------------------------------------------------------------------- | | XcodeProj| tuist/XcodeProj | | ACKategories | AckeeCZ/ACKategories |

If you are also leveraging Tapestry in your project, feel free to open a PR to include it in the list above.

These repositories can also serve as a great example configuration for your own projects.


Using Homebrew

$ brew tap AckeeCZ/tapestry
$ brew install tapestry
$ tapestry

Using SPM

Add this to your Package.swift:

.package(url: "https://github.com/AckeeCZ/tapestry.git", .branch("master")),

Using Swift directly

$ git clone https://github.com/AckeeCZ/tapestry.git
$ cd tapestry
$ swift run tapestry

Generating project


To generate your project, simply run:

tapestry init --path TapestryProject

You can omit --path argument and it will generate your framework in the current directory.

It uses tuist and SPM tools, so it's very easy to adjust it to your needs (no complicated template structure, all code is generated from the ground up!)

You can change the generated files in InitCommand and your example project in ExampleModelLoader. In the future, I'd like to make this customization even easier, so watch this space 👀

Generated project features

  • CocoaPods, Carthage and Swift Package Manager compatibility
  • README.md template
  • travis to automate your builds
  • Library support
  • Executable support for your CLI tools
  • ☐ more and even more to come!

You can check out an example project that was generated with tapestry here.

Releasing project


Setup release steps

To get you started with tapestry (if you did not generate your framework with it!), you can run

tapestry up

This will create a tapestries folder in your repository - it will also from now use tapestry version that is defined in tapestries/Package.swift. You can add option --current to force running your installed version.

To configure your release steps, run:

tapestry edit

This opens Xcode, so you just have to navigate to TapestryConfig.swift.

The generated file will look like this:

import PackageDescription

let config = TapestryConfig(release: Release(actions: [.pre(.docsUpdate),
                                                       .pre(.dependenciesCompatibility([.cocoapods, .carthage, .spm(.all)]))],
                                             add: ["README.md",
                                             commitMessage: "Version \(Argument.version)",
                                             push: false))

Let's see how you can edit this by yourself to get the result you want.


This currently only has one argument release, more will be added here


The main component of the release process.

| Property | Description | Type | Optional | Default | | ------------- |:-------------:| :-----:| :-----:| :-----:| | actions | Your custom release steps, more about how you can define them below (see ReleaseAction) | [ReleaseAction] | No | [] | add | Glob of your files that you want to add to git before releasing a version | [String] | Yes | commitMessage | Commit message - use Argument.version in your string which will translate to the version you are releasing | String | No | push | This option determines if the changes are committed at the end | Bool | No |

Running tapestry release 0.0.4 also automatically tags the latest commit.


This type lets you define the individual actions.

| Case | Description | | ------------- |:-------------:| | pre(tool: String, arguments: [String] = []) | Runs before commiting and pushing. Runs the custom command from the root folder. | pre(_ predefinedAction: PredefinedAction) | Runs before commiting and pushing. Runs a PredefinedAction, more on that below. | post(tool: String, arguments: [String] = []) | Runs after commiting and pushing. Runs the custom command from the root folder. | post(_ predefinedAction: PredefinedAction) | Runs after commiting and pushing. Runs a PredefinedAction, more on that below.


This is a set of predefined actions.

| Case | Description | | ------------- |:-------------:| | docsUpdate | Updates version in your .podspec, README.md and adds it in CHANGELOG.md | run(tool: String, arguments: [String]) | You can run defined dev dependencies in tapestries/Package.swift | dependenciesCompatibility([DependenciesManager]) | Checks compatibility with given DependenciesManagers

Note that for docsUpdate your changelog must be in this format:

## Next

- your way of adding logs

## 1.0.0

Which will be changed to

## Next

## 1.0.1

- your way of adding logs

## 1.0.0

To change the version in your README.md, we use the latest tag in your git history.

You can also try out the individual actions:

tapestry run action docs-update 1.0.0
tapestry run action compatibilty spm carthage cocoapods


Let's you say what dependency managers you want to check compatibility for.

| Case | Description | | ------------- |:-------------:| | cocoapods | Runs compatibility check for Cocoapods | carthage | Runs compatibility check for Carthage | spm(Platform) | Runs compatibility check for SPM - define platform if you are using platform-specific libraries (eg UIKit)

Run developer dependencies

If you want to use developer dependencies using SPM, but don't want the users to download them since they are not essential to the project, you can add them to Tapestries/Package.swift.

If you then want to run it, just type:

tapestry run name-of-tool its-arguments

And it will run the tool you have previously defined - which means all the project's contributors can use the same version of your tooling!

Update local tapestry developer dependencies

To update local tapestry version and dependencies defined in Tapestries/Package.swift, you can simply run tapestry update.

Inspiration and thanks

I'd like to thank tuist for inspiration and help in this project. This project was also inspired by rocket


Stars: 46


Used By

Total: 0


- 2019-11-11 13:00:18

- 2019-10-30 09:12:50

Release configuration - 2019-10-25 11:54:35

Adding release configuration, so you can define your release steps in a type-safe way! Check out the updated documentation for more info.


  • Release configuration in a type-safe way https://github.com/AckeeCZ/tapestry/pull/8 by @fortmarek

- 2019-10-11 14:52:16