R.swift icon indicating copy to clipboard operation
R.swift copied to clipboard

`validate` logic error.

Open rakuyoMo opened this issue 2 years ago • 2 comments

Some prerequisites

I use Xcode Version 13.2.1 (13C100) and CocoaPods for iOS development.

I have a private Pod component that contains some color values stored in Assets.xcassets and I use R.swift in this private component to manage and use these colors.

My main project uses also uses Storyboard for development and also integrates with R.swift.

Problem

The problem is that I can use the color values in the Assets.xcassets in the private pod component in the storyboard file of the main project.

But in the validation code generated by R.swift for these Storyboards, the bundle used for the color values is the hostingBundle, i.e. the bundle of the main project. the correct value should be the bundle of the private pod.

This error caused me to abandon the validate method for now.

How do I deal with this problem? Has anyone else encountered a problem similar to mine?

rakuyoMo avatar Feb 16 '22 01:02 rakuyoMo

I did notice in #186 that a solution is mentioned or could be effective to solve this problem? Just unfortunately there is no sign of this being implemented yet.

rakuyoMo avatar Feb 16 '22 01:02 rakuyoMo

I currently have a different way of managing color to circumvent this problem.

I define all the colors in the main project and then create a private pod (ColorConfigPod) for managing the generic colors as an intermediary between the main project and the private pod.

The private pods that need to use these colors only need to rely on ColorConfigPod. Also after the main project integrates ColorConfigPod, the colors are registered with it through the interface.

I hope this temporary solution will help people with the same problem.

In the meantime I'm not going to close this issue for now, looking forward to a better official solution.

rakuyoMo avatar Mar 03 '22 02:03 rakuyoMo

In theory, this should now work correctly in version 7.0.0 If it somehow still doesn't work, please reply again.

tomlokhorst avatar Nov 28 '22 14:11 tomlokhorst

In theory, this should now work correctly in version 7.0.0 If it somehow still doesn't work, please reply again.

I'm still facing this issue on v 7.2.4

jsaiti avatar Mar 01 '23 10:03 jsaiti

@jsaiti Can you create a new issue with a detailed explanation of what you're trying to do and what isn't working?

tomlokhorst avatar Mar 05 '23 18:03 tomlokhorst