Technologies Natives

Tuist, iOS developer’s new best friend

As an iOS developer, you must surely have wasted valuable time trying to resolve one of those god awful conflicts in the project.pbxproj file. If you dread those conflicts as much as I do, let me introduce you to Tuist.

What is Tuist?

Tuist is a fruit of a great idea in frameworks' architecture combined with the lack of tools to easily support the maintenance of this architecture. The author and maintainer of Tuist, Pedro Piñera Buendía, built Tuist just to remedy that.

The concept of Tuist is really simple. Instead of dealing with all the dependencies, schemes and other project related configurations via Xcode, Tuist allows you to describe all those configurations in a Swift file, which is then used to generate the entire project. In some way, the project.swift replaces the project.pbxproj file as a more readable source of truth and skeleton of your project.

What are the advantages of Tuist for IOS developers ?

You don’t need a tooling team

That is Tuist’s motto. By abstracting Xcode intricacies, Tuist provides stability and performance, a crucial feature to boost productivity and helps developers focus on the important things such as architecture.

Benefit #1: Helps developers by reducing build time

Native development is often synonym of long build time.

With Tuist caching, targets that haven't been modified during development can be replaced by a pre-compiled version of themselves on build, thus reducing the build time for developer, especially on large scaled projects.

Clean compilation is 40% faster with Tuist, incremental ones are almost 50%
Bruno Bilescky (on Tuist Slack)

Benefit #2: Helps developers to create new feature faster

Tuist puts forward file scaffolding.

Given file templates, developers are one command away from generating new files for a new screen or a new feature.

For instance, given the following template:

++pre>++code class="language-swift">import ProjectDescription

let nameAttribute: Template.Attribute = .required("name")

let template = Template(
   description: "Viper",
   attributes: [
       nameAttribute,
       .optional("platform", default: "ios"),
   ],
   items: [
       .file(
           path: "Sources/modules/\(nameAttribute)/\(nameAttribute)View.swift",
           templatePath: "viper/view.stencil"
       ),
       .file(
           path: "Sources/modules/\(nameAttribute)/\(nameAttribute)Interactor.swift",
           templatePath: "viper/interactor.stencil"
       ),
       .file(
           path: "Sources/modules/\(nameAttribute)/\(nameAttribute)Presenter.swift",
           templatePath: "viper/presentor.stencil"
       ),
       .file(
           path: "Sources/modules/\(nameAttribute)/\(nameAttribute)Entity.swift",
           templatePath: "viper/entity.stencil"
       ),
       .file(
           path: "Sources/modules/\(nameAttribute)/\(nameAttribute)Router.swift",
           templatePath: "viper/router.stencil"
       )
   ]
)
++/pre>++/code>

executing tuist scaffold viper --name MyFeature may save up to 10 min of manually clicking in XCode, adding files and copying code.

Tuist provides a plain and direct way of describing the project's architecture. With Tuist, architecture definition and its maintenance should be more straightforward.

Benefit #3: Helps architects tame infrastructure complexity (#3, graph generation)

Visualising the global complexity of an evergrowing project can become less and less straightforward. Fortunately Tuist provides a command, tuist graph, that loads your project dependencies graph and exports it, either as a png image or in DOT format.

Benefit #4: Helps code reviewers with readable code

Modification in Xcode project can easily results in numerous change in the infamous .pbxproj file. Conflicts in .pbxproj file is also a source of error when merging pull requests and the file's complicated syntax makes the debugging even more painful. Tuist takes care of generating the file in the correct format, making both code review and debugging easier on the eyes.

These are the main advantages of adopting Tuist in your iOS project. Stay tuned for a detailed tutorial on how to create an app using Tuist from scratch.

Rejoins nos équipes