Log in
announcements

Introducing plugins

Plugins is a new feature that allows reusing Tuist building blocks across repositories. In this blog post we present the feature and how teams can leverage it to share project description helpers.

Building Tuist has taught us that there’s an opportunity to share elements of your projects across repositories. Let’s say you work in an agency with projects scattered across several repositories. In that scenario, you might want your projects to be consistently structured to remove the cognitive load when jumping between projects. That was not possible in Tuist. The manifest files were tied to a repository. Some projects tried to solve it by resorting to git submodules and cloning other repositories in specific directories to be seen by Tuist as local directories. However, that was a workaround and not a proper solution.

As a tool that helps teams with their challenges, it was a natural next step to allow teams to extract some Tuist elements into a separate repository and reuse them easily. The idea of building plugins was born.

Plugin.swift

A plugin is represented by a repository containing a Plugin.swift file and all the files that are part of the plugin. The current format of the manifest is simple, but we’ll continue to extend it as we add support for sharing more pieces:

import ProjectDescription let plugin = Plugin(name: “MyPlugin”)

This first implementation of plugins only supports reusing helpers. Those are defined under ProjectDescriptionHelpers like in the example below:

. ├── … ├── Plugin.swift ├── ProjectDescriptionHelpers └── …

Using a plugin

Then users can declare the plugins in their projects’ Config.swift file. They can indicate if they’d like the plugin to be read from a local directory or a remote repository (commit or tag).

import ProjectDescription let config = Config( plugins: [ .local(path: “/Plugins/MyPlugin”), .git(url: “https://url/to/plugin.git”, tag: “1.0.0”), .git(url: “https://url/to/plugin.git”, sha: “e34c5ba”) ] )

As easy as that. Then you should be able to use the helpers from the plugin in your project by simply importing the plugin:

import ProjectDescription import MyTuistPlugin let project = Project.app(name: “MyCoolApp”, platform: .iOS)

What’s next

Plugins are a powerful feature that opens the door to sharing content from your project with your organization’s projects and the industry. Imagine coming up with a project architecture that you think is neat, and you’d like to share it publicly. Companies used to do that through blog posts, but now, you can codify it into project description helpers and share them in a plugin 🤯.

Moreover, we are planning to open a new interface for users to provide project transformations (mappers) that are applied at generation time. Once we have them available, we’ll extend the plugins to support reusing them too.

Unlike the Swift Package Manager, we can be there right where our users need us. Listening to them and providing the features that they need to scale up their projects. If you are using Tuist, we encourage you to give plugins a shot and share thoughts and ideas in our community forum. Thanks for reading.

You might also like

Building your projects with Tuist 1.10.0
This blog post introduces the latest version of Tuist, 1.10 Alma, that starts making projects the source of truth for automation too by providing a standard command, "tuist build", for building projects.
Visualize your projects graph from Tuist 0.17.0
One of the difficulties of scaling up Xcode projects comes from the fact that Xcode doesn't provide a high-level picture of the structure of the project. Tuist 0.17.0 fixes that by providing a new command, 'tuist graph', that exports a graph of the project to help users of the tool visualize their project dependencies. This version also adds support for configuring Tuist globally, and also indicate the version of Xcode that is required to run the project.
Swift Macros at scale
Swift Macros, while powerful, can hinder build times. This blog post explains why and what we can do to mitigate the issue.

Supercharge your app development

Get started

We use cookies

This site uses cookies. By continuing to use our site, you agree to use of cookies.