Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R.swift doesn't work with Folders in Xcode 16 #914

Closed
tomlokhorst opened this issue Sep 26, 2024 · 4 comments · Fixed by #921
Closed

R.swift doesn't work with Folders in Xcode 16 #914

tomlokhorst opened this issue Sep 26, 2024 · 4 comments · Fixed by #921

Comments

@tomlokhorst
Copy link
Collaborator

Xcode 16 default project structure uses Folders instead of Groups.
R.swift ignores Folders, which means resources in them aren't added to R.*.

As a workaround, you can convert Folders back into Groups, this makes it work with R.swift.
CleanShot 2024-09-26 at 22 19 18@2x

Long term, R.swift should add support for scanning Folders.

@nicolasvergoz
Copy link

nicolasvergoz commented Oct 25, 2024

I just finished converting a huge project to folders, only to find out that RSwift is not compatible as is 😫

You have to set --input-type input-files --intput-files <path-to-file-1> --intput-files <path-to-file-2> for each files you need to be processed.

Here is what I did :

"$SRCROOT/scripts/rswift" generate \
  --input-type input-files \
  --input-files $SRCROOT/Resources/Assets.xcassets \
  $(find $SRCROOT/Resources/Fonts -name '*.ttf' -exec echo --input-files {} \;) \
  $(find $SRCROOT/Resources/Fonts -name '*.otf' -exec echo --input-files {} \;) \
  $(find $SRCROOT/Resources/Strings -name '*.strings' -exec echo --input-files {} \;) \
  $(find $SRCROOT/Resources/Strings -name '*.stringsdict' -exec echo --input-files {} \;) \
  $(find $SRCROOT/Resources/Files -name '*.json' -exec echo --input-files {} \;) \
  $(find $SRCROOT/ -name '*.storyboard' -exec echo --input-files {} \;) \
  $(find $SRCROOT/ -name '*.xib' -exec echo --input-files {} \;) \
  --target YOUR_TARGET \
  "$SRCROOT/R.generated.swift"

I don't know if target is necessary though

@tomlokhorst
Copy link
Collaborator Author

Indeed --input-type input-files is the version used for SPM plugins. That works by providing individual files, like you did here with the find commands.

The default mode for Xcode build tool plug-ins is --input-type xcodeproj, which scans the Xcode project file for resources. That version doesn't handle folder references yet.

Your solution is a good workaround in the meantime. The target isn't needed.

@anatoliykant
Copy link

As far as I understand, this problem was fixed in the latest version of swiftlint?!
At least this error disappeared for me.

@fthdgn
Copy link

fthdgn commented Nov 2, 2024

I opened an PR about this error.
#920

Also I needed to update XcodeEdit project.
tomlokhorst/XcodeEdit#48

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants