Xcodegen vs. Tuist vs. Bazel — Comparing the 3 Tools to Supercharge Your iOS Projects | by Anurag Ajwani | Apr, 2022

iOS Dev Instruments

Know which one is best for you

Picture by Vlad Tchompalov on Unsplash

Hate Xcode? You’re not alone. Some folks like it. Some have a love-hate relationship with it; together with myself.

Xcode evaluations within the App Retailer

Why do some builders hate it a lot? There may be many causes nevertheless listed below are some:

  • Xcodeproj recordsdata are unreadable and never maintainable
  • Lack of venture goal kind configurability
  • Gradual builds

So is there any method we are able to rid of Xcode for iOS growth? In easy the reply is not any. Nevertheless, there are some choices to repair a number of of the issues talked about above.

On this put up, I might be reviewing 3 of the most well-liked choices to supercharge your iOS app venture capabilities. These are:

  1. XcodeGen
  2. Tuist
  3. Bazel

I’ll cowl what every of those provides and a information on methods to work with them.

All through this put up, I assume you’re comfy with iOS growth, and Xcode and have an excellent understanding on modules in iOS app initiatives.

XcodeGen is a command-line device that generates xcodeproj recordsdata. To specify the configuration of the Xcode venture XcodeGen makes use of a YAML or JSON file. Then XcodeGen converts the JSON or YAML into xcodeproj recordsdata.

Right here is an instance YAML file from my tutorial on Xcodegen:

identify: SaladMaker
choices:
bundleIdPrefix: com.<YOUR_NAMESPACE>
targets:
SaladMaker:
kind: software
platform: iOS
deploymentTarget: "14.0"
sources:
- SaladMaker

The recordsdata are way more readable than Xcodeproj recordsdata. You may create a number of of those recordsdata for various configurations of your venture. Or you can even generate these recordsdata out of your alternative of language. For instance, you should utilize a scripting language to generate the file.

Moreover XcodeGen additionally offers a Swift library which you can import and use in Swift-based CLI tool.

XcodeGen helps Swift Package deal Supervisor.

It is very important notice that XcodeGen is solely an Xcodeproj recordsdata generator. It doesn’t provide every other options.

The nice

✅ extremely readable and easy configuration recordsdata

✅ configuration recordsdata may be simply be generated out of your alternative of language

The dangerous

❎ Lack of caching options

To discover ways to use XcodeGen try my tutorial Generating xcodeproj’s with Xcodegen:

Tuist is a device that additionally generates xcodeproj recordsdata like XcodeGen. Nevertheless, Tuist’s venture configuration recordsdata are written in Swift. Moreover the configuration file mimicks the strategy to configuration just like Swift’s Package Manager Package deal.swift.

Right here is an instance:

import ProjectDescriptionlet venture = Mission(
identify: "SaladMaker",
organizationName: "com.anuragajwani",
targets: [
Target(
name: "SaladMaker",
platform: .iOS,
product: .app,
bundleId: "com.anuragajwani.SaladMaker",
deploymentTarget: .iOS(targetVersion: "14.0", devices: .iphone),
infoPlist: "SaladMaker/Info.plist",
sources: ["SaladMaker/**"],
assets: ["SaladMaker/Assets.xcassets/"]
)
]
)

The above achieves the identical as the instance for XcodeGen.

Moreover Tuist helps Swift Package Manger dependencies.

Tuist additionally permits you to cache modules–each inside and SPM managed–inside your configuration. This helps with rushing up construct instances.

On high of that Tuist permits you to have a slender deal with the modules that you must work on while every little thing is hidden from view and cached. Nevertheless the developer wants to grasp which modules wants modification earlier than hand, and configure the venture accordingly.

Tuist provides distant caching by a centralised service referred to as Tuist Cloud free of charge for the second. This nevertheless is in alpha on the time of writing.

. You may comply with the steps here to get your self began. We recognize any suggestions — but additionally take note the characteristic remains to be early in growth. The characteristic is at the moment free of charge however take into account donating here to help the event and assist us pay the payments for holding Tuist Cloud up and working. — Releasing Tuist 3.0

The nice

✅ extremely readable and less complicated configuration recordsdata

✅ Swift based mostly configuration recordsdata, in step with the remainder of the ecosystem

✅ capability to cache modules to hurry up construct instances

✅ capability to have a slender deal with the modules that want engaged on

The dangerous

❎ Configuration recordsdata are bigger than XcodeGen’s

❎ Probably much less readable configuration recordsdata in comparison with XcodeGen

❎ Caching just isn’t seamless

❎ Distant caching requires centralised service

To discover ways to use Tuist try my tutorial “Generating Xcodeproj’s with Tuist”:

Bazel is not like XcodeGen and Tuist. The earlier instruments construct on high of Xcode. Bazel doesn’t improve Xcode venture administration. Relatively Bazel is a construct system. Bazel construct configurations are written in a language referred to as Starlank which is dialect of Python.

The good thing about Bazel is that it’s a third social gathering open supply device. Anybody can contribute to the device and create plugins.

There are already an excellent variety of plugins for Bazel that can assist you construct iOS purposes. However why would you utilize Bazel if the construct produces the identical output as Xcode?

You may’t repair Xcode construct system which may be flaky at instances. However you’ll be able to repair or create your individual plugins for Bazel.

Moreover like Tuist, Bazel provides caching. Nevertheless Bazel caches and builds upon seamlessly. Moreover you’ll be able to cache your builds remotely in a server controller by you.

Nevertheless Bazel does solely constructing. It’s a construct system. So how are you going to do different operations resembling debugging? Operations which we’re accustomed executing by Xcode. You continue to want Xcode. For such you’ll be able to generate xcodeproj recordsdata from the Bazel construct recordsdata through the use of a device referred to as Tulsi or utilizing a Bazel plugin referred to as XCHammer.

The nice

✅ capability to cache builds

✅ seamless native caching–little to no configuration required by the developer

✅ distant caching obtainable

The dangerous

❎ extra advanced migration required to make use of the device in comparison with XcodeGen and Tuist

❎ builders could require studying a brand new language

❎ the device may be sluggish to supply updates to match capabilities provided by Xcode

❎ poor documentation

To discover ways to use Bazel try my tutorial “Building iOS apps faster using Bazel”:

More Posts