Closed tomlokhorst closed 1 week ago
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
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.
As far as I understand, this problem was fixed in the latest version of swiftlint?! At least this error disappeared for me.
I opened an PR about this error. https://github.com/mac-cain13/R.swift/pull/920
Also I needed to update XcodeEdit project. https://github.com/tomlokhorst/XcodeEdit/pull/48
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.
Long term, R.swift should add support for scanning Folders.