TuistString+App can’t solve \”
Few days ago I completed migrating to Tuist an App, supporting multiple languages. But I met an error I hadn’t seen before when building the migrated project.
Argument type module does not conform to expected type ‘CVarArg’ Replace ‘,“ with “ as! CVarArg’
It seemed like referring to the Localizable.strings. This error was occured in TuistString+.swift. So it was generated by Tuist automatically.
My Localizable.string was like this.
I put double quates into the String key.
"\"WhereWeGo\" needs to use your location" = "\"WhereWeGo\" needs to use your location";
This Localizable enum enables us to access resources by code easily.
So I changed to ‘WhereWeGo’
to solve this problem.
However I was curious about why Tuist generated this Swift file.
I asked GPT ‘how to turn off strings enum generation in Tuist?’
He answered
Project(
...,
resources: [
.process("Resources"),
.exclude("Resources/Localizable.strings") // Exclude specific files if necessary
],
...
resourceSynthesizers: [
.assets(),
.fonts()
// Exclude .strings() here to avoid generating enums for strings.
]
)
So what is resourceSynthesizers?
It is explained in the documentation, but not much.
So I looked into ResourceSynthesizer
It supports generations of various type of resource.
There might be various way to solve this issue, but I just remove all generation like following manifest.
Project(
...,
resources: [
...
],
...
resourceSynthesizers: [] // set empty to remove all default generation
)
I could exclude Localizalbe.strings file, but my app requires it.
resources: [
.process("Resources"),
.exclude("Resources/Localizable.strings") // Exclude specific files if necessary
],
See you later.
Happy Tuisting!
If you found any helpful from this post, please give it a round of applause 👏. Explore more Tuist-related content in my other posts.
You can give me claps up to 50 if you keep pressing the button :)