R.swift: Generate R.generated.swift file from terminal.

Created on 5 Oct 2016  路  7Comments  路  Source: mac-cain13/R.swift

Could some one help me with this issue

I am doing like this now

./rswift -p /Users/path/Project/Project.xcodeproj  

And get
error: [R.swift] Output folder for the 'R.generated.swift' file is mandatory as last argument.

I've try different scenarios ..but it doesn't work.

Most helpful comment

WOW... never know that scripts could be draggable .. thanks for help. I have dragged it on top and that solved my issue. Thanks again.

All 7 comments

You should at least give the output directory where R.swift should put the generated file, for example: ./rswift -p /Users/path/Project/Project.xcodeproj /Users/path/Project

See also the installation instruction, especially the build step you have to add.

I did exactly as you say but it didn't help me. I have add R swift previously as a script on this project but now I'm moving at swift 3 and need to regenerate file and because I have an errors it's not possible to run script at Xcode.

Are you using R.swift 3.0.0? You need the new version if you need Swift 3. I would advise running it from the Xcode build step instead from the command line yourselves, since that makes sure R.swift is using the same output folder and settings as before.

Downloading dependencies
...................
Using R.swift (3.0.0)
Using R.swift.Library (3.0.1)

To build project correctly and launch scripts I need to run it without errors but my project already use R.generated.swift file that was generated for Swift 2.3 Old methods bring me a conflicts. I'm trying to find a solution how to regenerated this file on a earlier stage, for example via terminal and just replace old one with a new one.

If you put the R.swift build step _before_ the Compile Sources step in Xcode it will update the R.swift generated before the compiler will start. So you should always be able to run R.swift even if your code won't compile at the moment.

It is also possible to run the rswift binary from the commandline if you want to, but you will need to specify all the flags it needs, those are the mandatory flags:

rswift [-p|--xcodeproj] [-t|--target] [--bundleIdentifier]
    [--buildProductsDir] [--developerDir] [--sourceRoot] [--sdkRoot]
    [--productModuleName] outputDirectory

I think it would help if you share the exact errors you're getting at the moment, that would give me some context about what could be going wrong.

WOW... never know that scripts could be draggable .. thanks for help. I have dragged it on top and that solved my issue. Thanks again.

You're welcome, good to hear that fixes things!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomlokhorst picture tomlokhorst  路  3Comments

mac-cain13 picture mac-cain13  路  4Comments

andreadelfante picture andreadelfante  路  6Comments

tomlokhorst picture tomlokhorst  路  5Comments

darecki picture darecki  路  4Comments