mac-cain13 / R.swift

Strong typed, autocompleted resources like images, fonts and segues in Swift projects
MIT License
9.5k stars 767 forks source link

[Rswift 7][SPM] Cannot embed anymore R.generated in app #850

Open dev-pac opened 1 year ago

dev-pac commented 1 year ago

Hi, I used to use R.swift has a pod in my project, and embed the R.generated file into app so as to have all languages texts embedded and allow user to change app language on demand. As for Rswift 7, preferred method is using SPM to add it to xcode project. But with this method Rswift will generate the R.generate file into DerivedData/... folder, preventing project to embed it into app.

Is there a way to provide a command line argument to the Rswift generator to specify a destination path ?

rafalwojcik commented 1 year ago

Same problem here. I was generating some additional things based on assets using Sourcery. Since now the generated file doesn't live in the project file sourcery can't read it :/

tomlokhorst commented 1 year ago

With Rswift 7, you can still call it from the command line and pass any required arguments.

You can also use the manual version of the generator, that only runs when you right click on a project and click RswiftGenerateResourcesCommand.

These options aren't available when using the Built Tool Plug-in generators. So it's either fully automatic, or manual and customisable.

tomlokhorst commented 1 year ago

Maybe possible to call the RswiftGenerateResourcesCommand SPM plugin from a Run Script in an Xcode target? I haven't tried that.

anhlq-supp commented 4 months ago

Manually embed the library worked for me https://github.com/mac-cain13/R.swift/issues/831