0

I'm experimenting with XcodeGen, and ran into a problem. I can't add "R.Swift" dependency. Not through SPM not through CocoaPods(

In the case of SPM, I don't understand how to add Run Build Tool Plug-in "RswiftGeneratesInternalResources (Swift)" into target/Build Phases

In the case of Cocoapods in R.generated.swift file an error appears "No such module 'Rswift'

Can anyone help me and show correct way how I can add R.swift into XcodeGen project?

Sergey
  • 358
  • 3
  • 12
  • The docs tell you what to do: https://github.com/mac-cain13/R.swift#xcode-project---spm – matt May 03 '23 at 11:46

3 Answers3

0

In the end, I just moved to SwiftGen) It turned out to be much easier to work with it in the XcodeGen project.

Sergey
  • 358
  • 3
  • 12
0

Here is my project.yml. (with cocoapods, not spm.)

targets:
  MyApp:
    type: application
    platform: iOS 
    sources:
      - MyApp
    preBuildScripts:
      - name: Generate R.swift
        script: |
          "$PODS_ROOT/R.swift/rswift" generate "$SRCROOT/MyApp/R.generated.swift"
        basedOnDependencyAnalysis: false

-2

To add R.swift to Xcodegen using SPM, you can do the following steps:

  • Download released R.swift package from https://github.com/mac-cain13/R.swift/releases. Extract downloaded .zip file, copy rswift file and place it in the directory where your .xcodeproj file lives, eg. scripts/rswift
  • Open the project.yml file and declare R.swift as a dependency. Make sure to add RswiftLibrary as the package's product.
  • Modify the build Run script with the following changes:

"$SRCROOT/scripts/rswift" generate "$SRCROOT/R.generated.swift"

By following these steps, you can integrate R.swift into Xcodegen using SPM.

Son Le
  • 1