1

We're building an app that has different versions for different countries.

As part of a localisation effort I'm aiming to write a script that swaps certain asset files with another based on the language parameter.

I've written a python script for this using a python library, but that has a bug where on editing the files xcode doesn't really recognise the structure anymore and we have to restart xcode.

So the newer approach is to use this ruby gem.

I am fetching the project and I can access the files

project = Xcodeproj::Project.open(project_path)
target = project.targets.first
files = target.source_build_phase.files.to_a.map

But I can't find anything in the documentation where it would allow me to remove a file from just one target.

I have thought about creating a new target and adding all the files except the one I want deleted. But I think that seems overkill for the issue we're trying to solve.

Aatish Molasi
  • 2,138
  • 3
  • 20
  • 43

0 Answers0